shared-resource-cache: A thread-safe cache for sharing resources across threads with automatic expiry

[ concurrency, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

A cache designed for guaranteeing that different threads can share the same reference to a resource. For example, it allows threads to communicate via a shared . Using , items are only removed from the cache after no sharers are holding the resource and the item has expired (according to the expiry configuration the cache was constructed with.)

Note: an MVar is used to coordinate between threads that only one thread does the initial load of the resource with the given IO action if multiple threads try and retrieve a resource that is not yet cached at the same time.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), list-t (>=1.0 && <1.1), resourcet (>=1.3 && <1.4), stm (>=2.4 && <2.6), stm-containers (>=1.2 && <2), text (>=2.0 && <2.2), time (>=1.12 && <2) [details]
License MIT
Copyright 2026 Gordon Martin
Author Gordon Martin
Maintainer gordonhughmartin@gmail.com
Uploaded by happy0 at 2026-03-22T23:17:32Z
Category Concurrency
Home page https://github.com/happy0/shared-resource-cache#readme
Bug tracker https://github.com/happy0/shared-resource-cache/issues
Source repo head: git clone https://github.com/happy0/shared-resource-cache
Downloads 2 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-03-22 [all 1 reports]

Readme for shared-resource-cache-0.1.0.1

[back to package description]

shared-resource-cache

A cache designed for guaranteeing that different threads can share the same reference to a resource. For example, it allows threads to communicate via a shared TChan broadcast channel. Using resourcet, items are only removed from the cache after no 'sharers' are holding the resource and the item has expired (according to the expiry configuration the cache was constructed with.)

Note: an MVar is used to coordinate between threads that only one thread does the initial load of the resource with the given IO action if multiple threads try and retrieve a resource that is not yet cached at the same time.