Skip to content

Conversation

@bootjp
Copy link
Owner

@bootjp bootjp commented Dec 9, 2025

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the AdaptSize cache library from a full key-value store to a policy-only admission controller. The cache no longer stores actual values or manages LRU eviction—instead, callers integrate it with their own storage layer and use the Request API to record accesses and get admission decisions for cache misses. The core AdaptSize algorithm (probabilistic admission via exp(-size/c) with automatic c-parameter tuning) remains unchanged.

Key Changes:

  • Replaced Get/Set methods with a single Request method that records metrics and returns admission decisions
  • Removed internal storage structures (items map, lru list, entry type) and capacity tracking
  • Updated all tests to use the new API pattern where callers specify Hit status

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
go.mod Updates Go version (contains invalid version number)
adaptsize/adaptsize.go Removes value storage and LRU eviction; adds Request API for admission decisions only
adaptsize/adaptsize_test.go Updates existing tests to Request API; adds new tests for hit recording, oversize handling, EMA computation, and no-data tuning behavior
README.md Updates usage example to demonstrate Request API pattern with caller-managed cache storage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bootjp bootjp merged commit 03e38dc into main Dec 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants