feat(registry): implement client-side LRU cache with TTL and ID validation #28
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#22 Epic: Package Registry Client — Support Package Registry Standard v1.0.0
cleveragents/cleveractors-core
#42 feat(registry): implement RegistryCache with LRU eviction and TTL
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
RegistryCachewith LRU eviction and configurable max sizeRegistryClientas transparent caching layerAcceptance criteria
Subtasks
src/cleveractors/registry/cache.pywithRegistryCacheclassRegistryClientas transparent caching layerDefinition of Done
This issue is complete when:
CoreRasurae referenced this issue2026-06-05 17:36:35 +00:00
CoreRasurae referenced this issue2026-06-05 17:36:55 +00:00
Client-side caching — LRU cache with TTL and ID validationto feat(registry): implement client-side LRU cache with TTL and ID validationImplemented by PR #42 (#42)
Integration Directives — RegistryCache ↔ PackageContentResolver
This comment documents the integration architecture that was followed when wiring the
RegistryCacheinto thePackageContentResolver, consistent with Package Registry Standard v1.0.0 §10.3 and the project's SOLID principles.Integration Directives Applied
Directive 1 — Two-tier caching architecture
The
PackageContentResolvernow operates with two distinct cache layers serving different purposes:OrderedDict(LRU, max 128)reference:type_original_reference,_server,_namespace,_name,_versionmetadataRegistryCache(LRU+TTL+SHA-1)package_idResolution cache handles the fast path for
resolve()/aresolve()callers. Content cache handles the content-integrity path forget_package()callers and is warmed automatically by resolution.Directive 2 — CacheFactory (Factory Method + Dependency Injection)
CacheFactorycentralises cache creation so that:max_size,ttl,validate_content) is specified once at the factory levelPackageContentResolverdepends on the factory abstraction, not onRegistryCachedirectlyWhen
cache_factory=None, the content cache tier is disabled and only the resolution cache is used — full backward compatibility.Directive 3 — Content warming on resolution
When
_resolve_registry_async()fetches content viaRegistryClient.resolve_package(), thepackage_idfrom the response is used to warm the per-server content cache viaRegistryCache.put(). Subsequentget_package()calls for the samepackage_idthrough the same server hit the local content cache instead of the network. Warming failures are logged at debug level and never block resolution.Directive 4 — Resource lifecycle consistency
close_all()now closes content caches FIRST (under the async lock) before closing raw clients, so that in-flight cache operations complete cleanly.aclear_cache()clears both resolution and content tiers in one async operation.Directive 5 — Single-flight is preserved
RegistryCache._singleflight_fetchcoalesces concurrent misses into a single upstream fetch. This behaviour is preserved by the integration — whenget_package_cached()delegates toRegistryCache.get_package(), concurrent callers for the same cold key share a single upstream request.Patterns Used
CacheFactory.create()PackageContentResolver(cache_factory=...)RegistryCacheis the content-cache strategy whencache_factory is not Noneget_package_cached(package_id, server)CacheFactory(creation),RegistryCache(caching),PackageContentResolver(resolution)PackageContentResolverdepends onCacheFactory, notRegistryCacheFiles Changed
src/cleveractors/registry/cache.pyCacheFactoryclass andRegistryCache.put()methodsrc/cleveractors/registry/reference_resolver.pyPackageContentResolvernow acceptscache_factory, manages per-server content caches, warms cache on resolution, closes caches on shutdown, exposesget_package_cached()andaclear_cache()src/cleveractors/registry/__init__.pyCacheFactoryIntegration documented by Luis