CacheExtension
Defined in: src/cache/CacheExtension.ts:18
System-wide registry for named caches. Apps that need more than one
cache (e.g. a Redis-backed response cache and a separate Memcached
idempotency-store) register each one under a stable name and look it
up via system.extension(CacheExtensionId).cache(name).
The default cache is always available and starts as an
InMemoryCache — handy for tests and dev. Registering a different
factory under 'default' (or selecting via the HOCON path
actor-ts.cache.default.plugin) replaces it.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CacheExtension(
system):CacheExtension
Defined in: src/cache/CacheExtension.ts:22
Parameters
Section titled “Parameters”system
Section titled “system”Returns
Section titled “Returns”CacheExtension
Methods
Section titled “Methods”cache()
Section titled “cache()”cache(
name?):Cache
Defined in: src/cache/CacheExtension.ts:46
Resolve a cache by name. Names map to plugin ids via the HOCON
path actor-ts.cache.<name>.plugin. Unknown names fall back to
the in-memory plugin so callers always get something — handy for
tests where config wiring would be busywork.
Parameters
Section titled “Parameters”string = 'default'
Returns
Section titled “Returns”close()
Section titled “close()”close():
Promise<void>
Defined in: src/cache/CacheExtension.ts:63
Best-effort close of every instantiated cache.
Returns
Section titled “Returns”Promise<void>
registerCache()
Section titled “registerCache()”registerCache(
pluginId,factory):void
Defined in: src/cache/CacheExtension.ts:32
Register a cache factory under pluginId. The factory runs lazily
on the first cache(name) call that resolves to this plugin via
config. Re-registering the same id replaces the factory and forces
a re-instantiation on next access.
Parameters
Section titled “Parameters”pluginId
Section titled “pluginId”string
factory
Section titled “factory”(system) => Cache
Returns
Section titled “Returns”void
setCache()
Section titled “setCache()”setCache(
name,cache):void
Defined in: src/cache/CacheExtension.ts:58
Replace the cache instance for name directly — useful for tests.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void