Moka 0.12.15
- Fixed a bug where re-inserting an expired entry could cause it to lose its expiration time and remain in the cache indefinitely when using a custom
Expirypolicy with per-entry expiration. (#582 by @jiangzhe, #581 by @atrocities, reported in #575):- This occurred when an entry that had expired but not yet been evicted was re-inserted, and
expire_after_updatereturnedNone. This primarily affected users who only overrideexpire_after_create, since the defaultexpire_after_updatereturnsduration_until_expiry, which isNonefor expired entries. - This bug was introduced by the changes in v0.12.13 (#549 and #564).
- Subtle behavior change:
- Before this fix, re-inserting an expired entry was treated as an update, so
Expiry::expire_after_updatewas called. - After this fix, re-inserting an expired entry is treated as a creation, so
Expiry::expire_after_createis called instead. - This may change the expiration time of re-inserted entries, depending on your
Expirytrait implementation.
- Before this fix, re-inserting an expired entry was treated as an update, so
- This occurred when an entry that had expired but not yet been evicted was re-inserted, and
- Fixed flaky tests
cht::segment::tests::drop_many_valuesanddrop_many_values_concurrentthat were failing on high-core-count machines (#586):- These tests were using a CPU-dependent segment count, causing inconsistent bucket array shrinking behavior of the internal segmented hash map across different machines.
- Changed these tests to use a fixed segment count (4) for consistent results.
Moka 0.12.14
- Fixed a race condition in the
and_compute_withmethod in thefuture::Cache. (#574 by @Squadrick):- When multiple calls are made concurrently for the same key, the
fclosure may read a stale value, causing the first update to be lost when it is overwritten by a later one.
- When multiple calls are made concurrently for the same key, the
- Use
dep:keyword in the crate features. (#577 by @alexanderkjall).
Moka 0.12.13
- Fixed/mitigated use-after-free issues in the hierarchical timer wheels when
ExpiryreturnsNone(Issue #565, reported by @sharksforarms). - Fixed
Expiry::expire_after_updatenot clearing expiration time for expired entries (future::Cache: #549, by @singulared,sync::Cache: #564).
Moka 0.12.12
Bumped the minimum supported Rust version (MSRV) to 1.71.1, released on August 3, 2023 (#555).