lazy-cache: Library for caching IO action that leverages on GHC RTS implementation
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
The library provides an interface for caching the results of IO actions. This library relies on a blackholing — mechanism that is used to implement lazy evaluation for avoiding concurrent runs of the action (this is where the name of the library comes from).
The library provides caching mechanismsl with the following properties:
when the function is called the successful result is cached by no more than a provided time;
if the function ends with an exception, it will be rethrown, and the result will not be cached;
if the function will be called with the same input value it immediately gets cached result;
if functions are called concurrently with the different input values they will not block each other;
if functions will be called concurrently with the same argument then only one will act, others will wait until the first one is finished and will either return the result once it's received, or will rethrow an exception if the first one exits with an exception;
outdated values are cleared only on accesses to the cache, so if no action is called the data will not be cleared.
The main entry point of the library is System.Cache module, it explains how to use the library and provides the public API, that does not depend on the actual store implementation.
The library provides an interface for caching, and three implementations:
System.Cache.Impl.Ghc — the main one based on GHC system;
System.Cache.Impl.MVar — implementation based on library functions;
System.Cache.Impl.NoCache — implementation that disables caching, but keeps the same interface
If you want to implement your own caching mechanism, or use internal API, you can refer to the System.Cache.Internal.Interface module for an additional documentation.
[Skip to Readme]
Properties
Versions | 0.2.0.0, 0.2.0.0 |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.12 && <5), clock (>=0.8), hashable (>=1.1.2.3 && <1.5), psqueues (>=0.2 && <0.3) [details] |
License | MPL-2.0 |
Copyright | 2019-2022 (C) Фонд "Талант и Успех" |
Author | Alexander Vershilov |
Maintainer | backend-dev@sirius.online |
Category | System |
Source repo | head: git clone https://github.com/cheopslab/lazy-cache |
Uploaded | by AlexanderVershilov at 2023-01-06T06:54:15Z |
Modules
[Index] [Quick Jump]
Downloads
- lazy-cache-0.2.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees