Crate segcache

source ·
Expand description

This crate is a Rust implementation of the Segcache storage layer.

It is a high-throughput and memory-efficient key-value store with eager expiration. Segcache uses a segment-structured design that stores data in fixed-size segments, grouping objects with nearby expiration time into the same segment, and lifting most per-object metadata into the shared segment header. This reduces object metadata by 88% compared to Memcached.

A blog post about the overall design can be found here: https://pelikan.io/2021/segcache.html

Goals:

  • high-throughput item storage
  • eager expiration of items
  • low metadata overhead

Non-goals:

  • not designed for concurrent access

Structs

  • A builder that is used to construct a new Segcache instance.
  • Items are the base unit of data stored within the cache.
  • A pre-allocated key-value store with eager expiration. It uses a segment-structured design that stores data in fixed-size segments, grouping objects with nearby expiration time into the same segment, and lifting most per-object metadata into the shared segment header.

Enums

  • Policies define the eviction strategy to be used. All eviction strategies exclude segments which are currently accepting new items.
  • Possible errors returned by the top-level API