Mercurial > lbo > hg > memoize
changeset 33:e06b174fc82f
Update doc comment
author | Илья Ефимов <inferrna@gmail.com> |
---|---|
date | Fri, 11 Dec 2020 01:27:49 +0800 |
parents | a2ba1566dea3 |
children | 65332ad1cf1b |
files | src/lib.rs |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib.rs Fri Dec 11 01:00:18 2020 +0800 +++ b/src/lib.rs Fri Dec 11 01:27:49 2020 +0800 @@ -185,6 +185,9 @@ * The `memoize` attribute can take further parameters in order to use an LRU cache: * `#[memoize(Capacity: 1234)]`. In that case, instead of a `HashMap` we use an `lru::LruCache` * with the given capacity. + * `#[memoize(TimeToLive: Duration::from_secs(2))]`. In that case, cached walue will be actual + * no longer than duration provided and refreshed with next request. If you prefer chrono::Duration, + * it can be also used: `#[memoize(TimeToLive: chrono::Duration::hours(9).to_std().unwrap()]` * * This mechanism can, in principle, be extended (in the source code) to any other cache mechanism. *