Crate lfu_cache

source ·
Expand description

This crate provides an LRU cache with constant time insertion, fetching, and removing.

Storage of values to this collection allocates to the heap. Clients with a limited heap size should avoid allocating large values and instead use some form of indirection to avoid a heap overflow.

Performance of this LRU cache is bounded by constant time operations of a typical unsafe linked list on your platform. For most users, this is an implementation detail and can be ignored. However, for high throughput clients, this should be noted as performance might not be as this collection can not make better use of the CPU cache in comparison to array-based containers.

Structs

  • A collection that if limited to a certain capacity will evict based on the least recently used value.
  • A consuming iterator over the key and values of an LFU cache, in order of least frequently used first.
  • A view into an occupied entry in a LFU cache. It is part of the Entry enum.
  • A LFU cache with additional eviction conditions based on the time an entry has been in cache.
  • A view into a vacant entry in a LFU cache. It is part of the Entry enum.

Enums

  • A view into a single entry in the LFU cache, which may either be vacant or occupied.