3 releases

0.1.2 Feb 24, 2019
0.1.1 Feb 21, 2019
0.1.0 Feb 21, 2019

#399 in Caching

Download history 1/week @ 2023-11-04 4/week @ 2023-11-11 2/week @ 2023-11-18 8/week @ 2023-11-25 7/week @ 2023-12-02 4/week @ 2023-12-16 6/week @ 2023-12-23 1/week @ 2023-12-30 4/week @ 2024-01-06 6/week @ 2024-01-20 9/week @ 2024-01-27 4/week @ 2024-02-03 14/week @ 2024-02-10 46/week @ 2024-02-17

73 downloads per month

MPL-2.0 license

42KB
536 lines

cuckoocache

This Library provides a cuckoocache data structure in rust, similar to the one used in Bitcoin.

Cuckoocache is a great candidate for a signature cache store.

Summary:

  1. bitpacked is bit-packed atomic flags for garbage collection
  2. cache is a cache which is performant in memory usage and lookup speed. It is lockfree for erase operations. Elements are lazily erased on the next insert.

bit_packed::atomic::Flags implements a container for garbage collection flags that is only thread unsafe on calls to setup. This class bit-packs collection flags for memory efficiency.

All operations are Ordering::Relaxed so external mechanisms must ensure that writes and reads are properly synchronized.

On Cache::setup(n), all bits up to n are marked as collected.

Under the hood, because it is an 8-bit type, it makes sense to use a multiple of 8 for setup, but it will be safe if that is not the case as well.


lib.rs:

CuckooCache crate provides a high performance cache primitive

Summary:

  1. bitpacked is bit-packed atomic flags for garbage collection
  2. cache is a cache which is performant in memory usage and lookup speed. It is lockfree for erase operations. Elements are lazily erased on the next insert.

bit_packed::atomic::Flags implements a container for garbage collection flags that is only thread unsafe on calls to setup. This class bit-packs collection flags for memory efficiency.

All operations are Ordering::Relaxed so external mechanisms must ensure that writes and reads are properly synchronized.

On Cache::setup(n), all bits up to n are marked as collected.

Under the hood, because it is an 8-bit type, it makes sense to use a multiple of 8 for setup, but it will be safe if that is not the case as well.

No runtime deps