RegistryMetadataCache class

TTL-based in-memory cache for remote registry metadata.

Behavior

  • Cache is keyed by registry id (unique per RemoteRegistryOptions.id).
  • Each entry has an explicit TTL determined by RemoteRegistryOptions.cacheTtl.
  • A "fresh" entry (age < TTL) is returned without contacting the registry.
  • A "stale" entry (age >= TTL) triggers a background refresh; the stale data is still returned with a RegistrySource.fromCache flag set.
  • A missing entry triggers an immediate fetch.

Memory-only

Phase 2.3 uses memory-only caching. Disk caching is intentionally deferred. Extend RegistryMetadataCache with a storage backend in a future phase.

Credentials

No credentials are stored in the cache under any circumstances.

Corruption Handling

Because this is in-memory only, corruption is limited to programmer error. invalidate and clear can reset state if needed.

Constructors

RegistryMetadataCache()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
Number of registries with cached entries.
no setter

Methods

clear() → void
Removes all cache entries.
get(String registryId) → ({List<RemoteTemplateRecord> records, RegistrySource source})
Returns the cached RemoteTemplateRecord list for registryId.
getSource(String registryId) → RegistrySource?
Returns the RegistrySource for registryId without returning records.
has(String registryId) → bool
Returns true if a (possibly stale) cache entry exists for registryId.
invalidate(String registryId) → void
Removes the cache entry for registryId. No-op if absent.
isFresh(String registryId, Duration ttl) → bool
Returns true if the cache entry for registryId is still within ttl.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String registryId, List<RemoteTemplateRecord> records, RegistrySource source) → void
Stores records for registryId with provenance source.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited