- While handling cache refreshes in
DiskCache::cache_get
, treat deserialization failures as non-existent values
- Fix
DiskCache::remove_expired_entries
signature
- Add DiskCache store
- Add
disk=true
(and company) flags to#[io_cached]
- Include LICENSE file in
cached_proc_macro
andcached_proc_macro_types
- Add
CloneCached
trait with additional methods when the cache value type implementsClone
- Add
result_fallback
option tocached
proc_macro to support re-using expired cache values when utilizing an expiring cache store and a fallible function.
- Update redis
0.23.0
->0.24.0
- Fix #once sync_writes bug causing a deadlock after ttl expiry, jaemk#174
- Add
ahash
feature to use the faster ahash algorithm. - Set
ahash
as a default feature. - Update hashbrown
0.13.0
->0.14.0
- Release
*_no_cache
changes from0.45.0
. The change is in the proc macro crate which I forgot to release a new version of.
- Generate
*_no_cache
function for every cached function to allow calling the original function without caching. This is backwards incompatible if you have a function with the same name.
tokio
dependency has been removed fromproc_macro
feature (originally unecessarily included).async
feature has been removed from thedefault
feature. This is a backwards incompatible change. If you want to useasync
features, you need to enableasync
explicitly.- remove accidental
#[doc(hidden)]
on thestores
module
- Option to enable redis multiplex-connection manager on
AsyncRedisCache
-
Show proc-macro documentation on docs.rs
-
Document needed feature flags
-
Hide implementation details in documentation
-
Relax
Cached
trait'scache_get
,cache_get_mut
andcache_remove
key parameter. AllowK: Borrow<Q>
likestd::collections::HashMap
and friends. Avoids copies particularly onCached<String, _>
where now you can docache.cache_get("key")
and before you had tocache.cache_get("key".to_string())
.Note: This is a minor breaking change for anyone manually implementing the
Cached
trait. The signatures ofcache_get
,cache_get_mut
, andcache_remove
must be updated to include the additional trait bound on thekey
type:fn cache_get<Q>(&mut self, key: &Q) -> Option<&V> where K: std::borrow::Borrow<Q>, Q: std::hash::Hash + Eq + ?Sized, {
- Dependency to
lazy_static
andasync_once
are removed.
- Update redis
0.22.0
->0.23.0
- Update serial_test
0.10.0
->2.0.0
- Better code generation for
#[cached]
when thesync_writes
flag is true.
- Fix "sized" cache types (
SizedCache
,TimedSizedCache
) to check capacity and evict members after insertion. - Fixes bug where continuously inserting a key present in the cache would incorrectly evict the oldest cache member even though the cache size was not increasing.
- Add optional feature flag
redis_ahash
to enableredis
's optionalahash
feature
- Update
redis
to0.22.0
- Move
tokio
'srt-multi-thread
feature from being a default to being optionally enabled byasync_tokio_rt_multi_thread
- Fix makefile's doc target to match documentation, changed from
make sync
tomake docs
- Add flush method to ExpiringValueCache
- Fix proc macro argument documentation
- Disable futures
default-features
- Add cache-remove to redis example
- Mark the auto-generated "priming" functions with
#[allow(dead_code)]
- Fix documentation typos
- Replace dev/build scripts with a Makefile
- wasm support for non-io macros and stores
- Use
instant
crate for wasm compatible time
- Added
ExpiringValueCache
for caching values that can themselves expire. - Added COPYRIGHT file
- Make sure
AsyncRedisCacheBuilder
,RedisCacheBuilder
, andRedisCacheBuildError
publicly visible
- Replace
async-mutex
andasync-rwlock
used by proc-macros withtokio::sync
versions - Add optional
version
field toCachedRedisValue
struct - Cleanup feature flags so async redis features include
redis_store
andasync
features automatically
- Allow specifying the namespace added to cache keys generated by redis stores
- Bump hashbrown 0.11.2 -> 0.12: https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17
- Bump smartstring 0.2 -> 1: https://github.com/bodil/smartstring/blob/master/CHANGELOG.md#100---2022-02-24
- Fix redis features so
redis/aio
is only included when async redis features (redis_tokio
/redis_async_std
) are enabled
- Fix how doc strings are handled by proc-macros. Capture all documentation on the cached function definitions and add them to the function definitions generated by the proc-macros. Add doc strings to generated static caches. Link to relevant static caches in generated function definitions. Add documentation to the generated cache-priming function.
IOCached
andIOCachedAsync
traitsRedisCache
andAsyncRedisCache
store types- Add
#[io_cached]
proc macro for defining cached functions backed by stores that implementIOCached
/IOCachedAsync
- Convert from travis-ci to github actions
- Update build status badge to link to github actions
- Add flush method to TimedSize and TimedSized caches
- Fix timed/timed-sized cache-get/insert/remove to remove and not return expired values
- proc-macro: support arguments of the wrapped function being prefixed with
mut
- Add failable TimedSize and SizeCached constructors
- Add
time_refresh
option to#[cached]
to refresh TTLs on cache hits - Generate
*_prime_cache
functions for every#[cached]
and#[once]
function to allow priming caches.
- Add
sync_writes
option to#[cached]
macro to synchronize concurrent function calls of duplicate arguments. For ex, if a long running#[cached(sync_writes = true)]
function is called several times concurrently, the actual function is only executed once while all other calls block and return the newly cached value.
- Add
#[once]
macro for create aRwLock
cache wrapping a single value - For all caches, add a function to get an immutable reference to their contents. This makes it possible to manually dump a cache, so its contents can be saved and restored later.
- Update deps hashbrown and darling, remove async-mutex from cached-proc-macro crate
- Add option to "timed" caches to refresh the ttl of entries on cache hits
- Add docs strings to the items generated by the
#cached
proc macro
cache_reset_metrics
trait method to reset hits/misses
- Refactor cache store types to separate modules
- Add support for returning a
cached::Return
wrapper type that indicates whether the result came from the function's cache.
- Support mutual
size
&time
args in the cached proc macro. Added when TimedSizedCache was added, but forgot to release the cached_proc_macro crate update.
- Add a TimedSizedCache combining LRU and timed/ttl logic
- Add new CachedAsync trait. Only present with async feature. Adds two async function in the entry API style of HashMap
- Add type hint
_result!
macros - remove unnecessary transmute in cache reset
- remove unnecessary clones in proc macro
- use
async-mutex
instead of fullasync-std
- Store inner values when
result=true
oroption=true
. TheError
type in theResult
now no longer needs to implementClone
.
- add
cache_set_lifespan
to change the cache lifespace, old value returned.
- fix proc macro when result=true, regression from changing
cache_set
to return the previous value
- add
Cached
implementation for stdHashMap
- trait
Cached
has a new methodcache_get_or_set_with
cache_set
now returns the previous value if any
- add Clone, Debug trait derives on pub types
- fix proc macro documentation
- proc macro version
- async support when using the new proc macro version
- Add
cache_get_mut
toCached
trait, to allow mutable access for values in the cache. - Change the type of
hits
andmisses
to beu64
.
- Add
value_order
method to SizedCache, similar tokey_order
- add
cache_reset
trait method for resetting cache collections to their initial state
- Update
once_cell
to 1.x
- Replace SizedCache implementation to avoid O(n) lookup on cache-get
- Update to Rust-2018 edition
- cargo fmt everything
- Replace inner cache when "clearing" unbounded cache
- Switch to
once_cell
. Library users no longer need to importlazy_static
- Add
cache_clear
andcache_result
toCached
trait- Allows for defeating cache entries if desired
- Update documentation
- Note the in-memory nature of cache stores
- Note the behavior of memoized functions under concurrent access
- Fixed duplicate key eviction in
SizedCache::cache_set
. This would manifest whencached
functions called with duplicate keys would race set an uncached key, or ifSizedCache
was used directly.
- Add
cached_result
andcached_key_result
to allow the caching of success for a function that returnsResult
. - Add
cached_control
macro to allow specifying functionality at key points of the macro
- Add
cached_key
macro to allow defining the caching key
- Tweak
cached
macro syntax - Update readme
- Update trait docs
- Update readme
- Update examples
- Update crate documentation and examples