feat(registry): implement client-side LRU cache with TTL and ID validation #28

Open
opened 2026-06-05 17:34:25 +00:00 by CoreRasurae · 0 comments
Member

Metadata

Commit Message: feat(registry): implement RegistryCache with LRU eviction and TTL
Branch: feature/m1-registry-client-cache

Background and context

The Package Registry Standard v1.0.0 (§10.3) requires clients to cache retrieved packages locally, validate cached content by recomputing SHA-1, and refresh based on TTL. This reduces network roundtrips and ensures content integrity.

Part of Epic: Package Registry Client — Support Package Registry Standard v1.0.0

Current behavior

No caching mechanism exists.

Expected behavior

  • RegistryCache with LRU eviction and configurable max size
  • TTL-based expiration: entries expire after configurable duration
  • Content validation: cached entries validated via SHA-1 recomputation
  • Tamper detection: mismatched SHA-1 triggers re-fetch
  • Thread-safe via asyncio locks
  • Integrates with RegistryClient as transparent caching layer

Acceptance criteria

  • Cache hit returns stored content without HTTP call
  • Stale entries (beyond TTL) trigger re-fetch
  • Tampered cache entries detected → re-fetch
  • LRU eviction respects size limit
  • Cache statistics exposed for observability
  • Concurrent access does not corrupt cache state

Subtasks

  • Create src/cleveractors/registry/cache.py with RegistryCache class
  • Implement LRU eviction policy with configurable max size
  • Implement TTL-based expiration with configurable duration
  • Implement content validation via SHA-1 recomputation
  • Integrate with RegistryClient as transparent caching layer
  • Expose cache statistics (hits, misses, evictions)
  • Tests (Behave): features/registry_cache.feature — hit/miss, TTL expiry, tamper detection, LRU eviction
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line matches the Commit Message in Metadata exactly.
  • The commit is pushed to the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a PR to master, reviewed, and merged.
## Metadata Commit Message: feat(registry): implement RegistryCache with LRU eviction and TTL Branch: feature/m1-registry-client-cache ## Background and context The Package Registry Standard v1.0.0 (§10.3) requires clients to cache retrieved packages locally, validate cached content by recomputing SHA-1, and refresh based on TTL. This reduces network roundtrips and ensures content integrity. Part of Epic: Package Registry Client — Support Package Registry Standard v1.0.0 ## Current behavior No caching mechanism exists. ## Expected behavior - `RegistryCache` with LRU eviction and configurable max size - TTL-based expiration: entries expire after configurable duration - Content validation: cached entries validated via SHA-1 recomputation - Tamper detection: mismatched SHA-1 triggers re-fetch - Thread-safe via asyncio locks - Integrates with `RegistryClient` as transparent caching layer ## Acceptance criteria - Cache hit returns stored content without HTTP call - Stale entries (beyond TTL) trigger re-fetch - Tampered cache entries detected → re-fetch - LRU eviction respects size limit - Cache statistics exposed for observability - Concurrent access does not corrupt cache state ## Subtasks - [ ] Create `src/cleveractors/registry/cache.py` with `RegistryCache` class - [ ] Implement LRU eviction policy with configurable max size - [ ] Implement TTL-based expiration with configurable duration - [ ] Implement content validation via SHA-1 recomputation - [ ] Integrate with `RegistryClient` as transparent caching layer - [ ] Expose cache statistics (hits, misses, evictions) - [ ] Tests (Behave): features/registry_cache.feature — hit/miss, TTL expiry, tamper detection, LRU eviction - [ ] Verify coverage >=97% via nox -s coverage_report - [ ] Run nox (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the first line matches the Commit Message in Metadata exactly. - The commit is pushed to the branch matching the Branch in Metadata exactly. - The commit is submitted as a PR to master, reviewed, and merged.
CoreRasurae added this to the v2.1.0 milestone 2026-06-05 17:34:25 +00:00
CoreRasurae changed title from Client-side caching — LRU cache with TTL and ID validation to feat(registry): implement client-side LRU cache with TTL and ID validation 2026-06-05 17:47:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveractors-core#28
No description provided.