Skip to content

product: ship Sky Cache bounded TTL/CAS service - #1

Merged
skylerblue333 merged 11 commits into
mainfrom
product/sky-cache-20260823
Aug 24, 2026
Merged

product: ship Sky Cache bounded TTL/CAS service#1
skylerblue333 merged 11 commits into
mainfrom
product/sky-cache-20260823

Conversation

@skylerblue333

Copy link
Copy Markdown
Owner

Product #13 of the SKYCOIN4444 standalone-product master plan.

This release candidate turns the existing local cache into a truthful standalone product: bounded thread-safe LRU storage, monotonic TTL expiration, set-if-absent, optimistic compare-and-set versions, metrics, FastAPI health/readiness/cache APIs, bounded JSON values, optional bearer authentication, deterministic tests, modern Python 3.12 dependencies, dependency audit and a non-root health-checked container.

Truthful boundary: this is a single-process ephemeral cache. It does not claim Redis compatibility, persistence, replication, distributed consensus, cross-node invalidation, HA, or multi-region consistency. Merge only after the exact PR head passes compile, Ruff, pytest, pip-audit, Docker build and non-root image verification.

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:d15e262ca6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadcache.py
Comment on lines +93 to +95
while len(self._entries) > self._max_entries:
self._entries.popitem(last=False)
self._stats["evictions"] += 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Purge expired entries before LRU eviction

When the cache is full and an expired entry is newer in the LRU order than a live entry, inserting another value pops the live entry here while retaining the expired one. For example, with capacity two, inserting live, then a zero-TTL expired, then new evicts live; the next purge removes expired and leaves the cache unnecessarily under capacity. Remove expired entries before choosing a live LRU victim.

Useful? React with 👍 / 👎.

Comment threadmain.py
Comment on lines +90 to +91
def get_value(key: str) -> dict[str, Any]:
entry = cache.get_entry(key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Convert GET key validation failures to client errors

For GET requests whose decoded key is whitespace-only or exceeds 512 characters, get_entry() raises ValueError, but this handler does not translate it to an HTTPException as the PUT and DELETE handlers do. Such client-controlled input therefore escapes as a server error instead of returning a 4xx response.

Useful? React with 👍 / 👎.

@skylerblue333
skylerblue333 merged commit a37f6ba into mainAug 24, 2026
2 checks passed
Sign up for freeto 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.

1 participant

@skylerblue333