timed_cache

Crates.iotimed_cache
lib.rstimed_cache
version0.1.1
sourcesrc
created_at2018-09-13 14:03:06.211989
updated_at2018-09-13 14:09:40.044763
descriptionAn implementation of a cache that will regenerate a value if accessed after a certain amount of time.
homepage
repositoryhttps://github.com/Plasticcaz/timed_cache
max_upload_size
id84527
size9,686
Zac (Plasticcaz)

documentation

README

Timed Cache

This library is an implementation of a cache that stores its contents by a key, as well as the duration of time that value will remain valid once it has been written to the cache.

If the value is missing when the user tries to retrieve a value from the TimedCache, or the value has outlived the specified storage Duration of the cache, the value will be regenerated using a specified function.

Example:

    let cache = TimedCache::with_time_to_keep(Duration::from_seconds(60));
    cache.get(&"key".to_owned(), || some_mutexed_service.lock().unwrap().call());

For information, please see the tests and documentation.

Contribution

I am more than willing to have help improving and extending this library. Please leave an issue and/or submit a pull request!

Commit count: 6

cargo fmt