breve

Crates.iobreve
lib.rsbreve
version0.1.0
created_at2025-03-12 16:24:35.097543+00
updated_at2025-03-12 16:24:35.097543+00
descriptionIn-memory cache implementation with Uno as the admission policy and S3-FIFO as the eviction policy
homepage
repositoryhttps://github.com/PsiACE/breve
max_upload_size
id1589983
size60,155
Chojan Shang (PsiACE)

documentation

README

Breve

Breve is a cache implementation that combines lightweight machine learning with efficient eviction strategies. It uses Uno as the admission policy and S3-FIFO as the eviction policy. This project is inspired by TinyUFO (Cloudflare) and builds upon its foundation with significant improvements.

Key Features

  • Lightweight Machine Learning: Utilizes the Uno algorithm for cache admission decisions, employing a simple linear regression model to predict item access value
  • Efficient Eviction Strategy: Based on an improved version of S3-FIFO, optimizing cache hit rates through separated queues and access counting
  • Concurrency Safety: Thread-safe implementation using atomic operations and lock-free data structures
  • Memory Efficiency: Offers both compact and fast storage backends to suit different needs

Core Components

Uno Admission Policy (by PsiACE)

Uno is a lightweight machine learning algorithm designed to predict the access value of cache items. It consists of two main components:

  • UnoSketch: A Count-Min Sketch based implementation for estimating item access frequency and reuse distance
  • UnoLearner: A simple linear regression model that optimizes prediction accuracy through online learning

S3-FIFO Eviction Policy

S3-FIFO is an efficient cache eviction algorithm, which Breve enhances with the following improvements:

  • Separates cache into small and large queues for better handling of different access patterns

  • Uses access counting to optimize eviction decisions

  • Supports weight-aware cache management

Why "Breve"?

There are a lot of really good caching libraries named in relation to coffee, so I chose to use Breve. Although I have been having two cappuccinos a day for the last few days.

Breve is particularly well-suited for:

  • High-concurrency cache systems
  • Applications with strict memory efficiency requirements
  • Scenarios requiring adaptive cache strategies

License

Breve is licensed under the Apache 2.0 License. Same as TinyUFO.

Commit count: 1

cargo fmt