| Crates.io | timed_cache |
| lib.rs | timed_cache |
| version | 0.1.1 |
| created_at | 2018-09-13 14:03:06.211989+00 |
| updated_at | 2018-09-13 14:09:40.044763+00 |
| description | An implementation of a cache that will regenerate a value if accessed after a certain amount of time. |
| homepage | |
| repository | https://github.com/Plasticcaz/timed_cache |
| max_upload_size | |
| id | 84527 |
| size | 9,686 |
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.
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.
I am more than willing to have help improving and extending this library. Please leave an issue and/or submit a pull request!