Skip to content

Latest commit

 

History

History
441 lines (301 loc) · 14.2 KB

CHANGELOG.md

File metadata and controls

441 lines (301 loc) · 14.2 KB

Moka Cache — Change Log

Version 0.8.6

Fixed

  • Fix a bug caused invalidate_all and invalidate_entries_if of the following caches will not invalidate entries inserted just before calling them (#155):
    • sync::Cache
    • sync::SegmentedCache
    • future::Cache
    • Experimental dash::Cache

Version 0.8.5

Added

  • Add basic stats (entry_count and weighted_size) methods to all caches. (#137)
  • Add Debug impl to the following caches (#138):
    • sync::Cache
    • sync::SegmentedCache
    • future::Cache
    • unsync::Cache

Fixed

  • Remove unnecessary K: Clone bound from the following caches when they are Clone (#133):
    • sync::Cache
    • future::Cache
    • Experimental dash::Cache

Version 0.8.4

Fixed

  • Fix the following issue by upgrading Quanta crate to v0.10.0 (#126):
    • Quanta v0.9.3 or older may not work correctly on some x86_64 machines where the Time Stamp Counter (TSC) is not synched across the processor cores. (#119)
    • For more details about the issue, see the relevant section of the README.

Added

  • Add get_with_if method to the following caches (#123):
    • sync::Cache
    • sync::SegmentedCache
    • future::Cache

Changed

The followings are internal changes to improve memory safety in unsafe Rust usages in Moka:

  • Remove pointer-to-integer transmute by converting UnsafeWeakPointer from usize to *mut T. (#127)
  • Increase the num segments of the waiters hash table from 16 to 64 (#129) to reduce the chance of the following issue occurring:
    • Segfaults under heavy workloads on a many-core machine. (#34)

Version 0.8.3

Changed

  • Make Quanta crate optional (but enabled by default) (#121)
    • Quanta v0.9.3 or older may not work correctly on some x86_64 machines where the Time Stamp Counter (TSC) is not synched across the processor cores. (#119)
    • This issue was fixed by Quanta v0.10.0. You can prevent the issue by upgrading Moka to v0.8.4 or newer.
    • For more details about the issue, see the relevant section of the README.

Version 0.8.2

Added

  • Add iterator to the following caches: (#114)
    • sync::Cache
    • sync::SegmentedCache
    • future::Cache
    • unsync::Cache
  • Implement IntoIterator to the all caches (including experimental dash::Cache) (#114)

Fixed

  • Fix the dash::Cache iterator not to return expired entries. (#116)
  • Prevent "index out of bounds" error when sync::SegmentedCache was created with a non-power-of-two segments. (#117)

Version 0.8.1

Added

  • Add contains_key method to check if a key is present without resetting the idle timer or updating the historic popularity estimator. (#107)

Version 0.8.0

As a part of stabilizing the cache API, the following cache methods have been renamed:

  • get_or_insert_with(K, F)get_with(K, F)
  • get_or_try_insert_with(K, F)try_get_with(K, F)

Old methods are still available but marked as deprecated. They will be removed in a future version.

Also policy method was added to all caches and blocking method was added to future::Cache. They return a Policy struct or BlockingOp struct respectively. Some uncommon cache methods were moved to these structs, and old methods were removed without deprecating.

Please see #105 for the complete list of the affected methods.

Changed

  • API stabilization. (Smaller core cache API, shorter names for common methods) (#105)
  • Performance related:
    • Improve performance of get_with and try_get_with. (#88)
    • Avoid to calculate the same hash twice in get, get_with, insert, invalidate, etc. (#90)
  • Update the minimum versions of dependencies:
    • crossbeam-channel to v0.5.4. (#100)
    • scheduled-thread-pool to v0.2.5. (#103)
    • (dev-dependency) skeptic to v0.13.5. (#104)

Added

Experimental Additions

  • Add a synchronous cache moka::dash::Cache, which uses dashmap::DashMap as the internal storage. (#99)
  • Add iterator to moka::dash::Cache. (#101)

Please note that the above additions are highly experimental and their APIs will be frequently changed in next few releases.

Version 0.7.2

The minimum supported Rust version (MSRV) is now 1.51.0 (2021-03-25).

Fixed

  • Addressed a memory utilization issue that will get worse when keys have hight cardinality (#72):
    • Reduce memory overhead in the internal concurrent hash table (cht). (#79)
    • Fix a bug that can create oversized frequency sketch when weigher is set. (#75)
    • Change EntryInfo from enum to struct to reduce memory utilization. (#76)
    • Replace some std::sync::Arc usages with triomphe::Arc to reduce memory utilization. (#80)
    • Embed CacheRegion value into a 2-bit tag space of TagNonNull pointer. (#84)
  • Fix a bug that will use wrong (oversized) initial capacity for the internal cht. (#83)

Added

  • Add unstable-debug-counters feature for testing purpose. (#82)

Changed

  • Import (include) cht source files for better integration. (#77, #86)

Version 0.7.1

  • Important Fix: A memory leak issue (#65 below) was found in all previous versions (since v0.1.0) and fixed in this version. All users are encouraged to upgrade to this or newer version.

Fixed

  • Fix a memory leak that will happen when evicting/expiring an entry or manually invalidating an entry. (#65)

Changed

  • Update the minimum depending version of crossbeam-channel from v0.5.0 to v0.5.2. (#67)

Version 0.7.0

  • Breaking change: The type of the max_capacity has been changed from usize to u64. This was necessary to have the weight-based cache management consistent across different CPU architectures.

Added

  • Add support for weight-based (size aware) cache management. (#24)
  • Add support for unbound cache. (#24)

Version 0.6.3

Fixed

  • Fix a bug in get_or_insert_with and get_or_try_insert_with methods of future::Cache, which caused a panic if previously inserting task aborted. (#59)

Version 0.6.2

Removed

  • Remove Send and 'static bounds from get_or_insert_with and get_or_try_insert_with methods of future::Cache. (#53)

Fixed

  • Protect overflow when computing expiration. (#56)

Version 0.6.1

Changed

  • Replace futures with futures-util. (#47)

Version 0.6.0

Fixed

  • Fix a bug in get_or_insert_with and get_or_try_insert_with methods of future::Cache and sync::Cache; a panic in the init future/closure causes subsequent calls on the same key to get "unreachable code" panics. (#43)

Changed

  • Change get_or_try_insert_with to return a concrete error type rather than a trait object. (#23, #37)

Version 0.5.4

Changed

  • Restore quanta dependency on some 32-bit platforms such as armv5te-unknown-linux-musleabi or mips-unknown-linux-musl. (#42)

Version 0.5.3

Added

  • Add support for some 32-bit platforms where std::sync::atomic::AtomicU64 is not provided. (e.g. armv5te-unknown-linux-musleabi or mips-unknown-linux-musl) (#38)
    • On these platforms, you will need to disable the default features of Moka. See the relevant section of the README.

Version 0.5.2

Fixed

  • Fix a bug in get_or_insert_with and get_or_try_insert_with methods of future::Cache by adding missing bounds Send and 'static to the init future. Without this fix, these methods will accept non-Send or non-'static future and may cause undefined behavior. (#31)
  • Fix usize overflow on big cache capacity. (#28)

Added

  • Add examples for get_or_insert_with and get_or_try_insert_with methods to the docs. (#30)

Changed

  • Downgrade crossbeam-epoch used in moka-cht from v0.9.x to v0.8.x as a possible workaround for segmentation faults on many-core CPU machines. (#33)

Version 0.5.1

Changed

  • Replace a dependency cht v0.4 with moka-cht v0.5. (#22)

Version 0.5.0

Added

  • Add get_or_insert_with and get_or_try_insert_with methods to sync and future caches. (#20)

Version 0.4.0

Fixed

  • Breaking change: Now sync::{Cache, SegmentedCache} and future::Cache require Send, Sync and 'static for the generic parameters K (key), V (value) and S (hasher state). This is necessary to prevent potential undefined behaviors in applications using single-threaded async runtime such as Actix-rt. (#19)

Added

  • Add invalidate_entries_if method to sync, future and unsync caches. (#12)

Version 0.3.1

Changed

  • Stop skeptic from having to be compiled by all downstream users. (#16)

Version 0.3.0

Added

  • Add an unsync cache (moka::unsync::Cache) and its builder for single-thread applications. (#9)
  • Add invalidate_all method to sync, future and unsync caches. (#11)

Fixed

  • Fix problems including segfault caused by race conditions between the sync/eviction thread and client writes. (Addressed as a part of #11).

Version 0.2.0

Added

  • Add an asynchronous, futures aware cache (moka::future::Cache) and its builder. (#7)

Version 0.1.0

Added

  • Add thread-safe, highly concurrent in-memory cache implementations (moka::sync::{Cache, SegmentedCache}) with the following features:
    • Bounded by the maximum number of elements.
    • Maintains good hit rate by using entry replacement algorithms inspired by Caffeine:
      • Admission to a cache is controlled by the Least Frequently Used (LFU) policy.
      • Eviction from a cache is controlled by the Least Recently Used (LRU) policy.
    • Expiration policies:
      • Time to live
      • Time to idle