Skip to content
@archipel/platform-caching Auto-generated

@pixel-brewery/archipel-platform-caching ​

Classes ​

ClassDescription
CachingHealthIndicatorHealth indicator for the caching layer.
MemoryLayeredCacheIn-memory layered cache with LRU eviction, TTL expiration and optional stale-while-revalidate support. Falls back to an asynchronous loader function on cache misses.
MemoryWindowedCounterWindowed counter held in the memory of one process.
NoopCacheMetricsRecorderNo-op implementation of ICacheMetricsRecorder used as the default when no external metrics backend is configured.
PostgresWindowedCounterWindowed counter kept in the application's own PostgreSQL database.
RedisLayeredCacheRedis-backed layered cache implementation. Falls back to an asynchronous loader function when the requested key is not present in Redis.
RedisWindowedCounterWindowed counter shared by every instance through Redis.

Interfaces ​

InterfaceDescription
ICacheMetricsRecorderMetrics recorder for cache operations. Implementations can forward measurements to Prometheus, OpenTelemetry, or any other backend.
ICacheStatsCache statistics snapshot returned by cache implementations.
ICreateWindowedCounterOptionsOptions for createWindowedCounter.
ILayeredCacheGeneric layered cache contract supporting synchronous and asynchronous access patterns with optional warm-up and statistics.
ILayeredCacheOptionsConfiguration options for MemoryLayeredCache.
IPostgresWindowedCounterOptionsConfiguration options for PostgresWindowedCounter.
IRedisLayeredCacheOptionsConfiguration options for RedisLayeredCache.
IRedisWindowedCounterOptionsConfiguration options for RedisWindowedCounter.
ISqlClientMinimal contract of a SQL client able to run a parameterized statement.
IWindowedCounterCounts occurrences inside a fixed time window.
IWindowedCounterResultResult of a windowed counter operation.

Variables ​

VariableDescription
CACHE_DEFAULT_TTL_MSDefault cache TTL in milliseconds applied when no provider-specific TTL is configured.
CACHE_MAX_ENTRIESMaximum number of entries retained in an in-memory cache (LRU limit).
CACHE_STALE_WHILE_REVALIDATEWhether expired entries are served while a background refresh is in progress.
PLATFORM_CACHING_CONFIG_ENTRIESAll configuration entries required by platform-caching.
REDIS_CONFIG_ENTRIESConfiguration entries required by the Redis caching provider.
REDIS_KEY_PREFIXKey prefix applied to all Redis keys managed by the cache instance.
REDIS_TTL_SECONDSTTL in seconds applied to every stored Redis entry.
REDIS_URLRedis connection URL (e.g. redis://localhost:6379).

Functions ​

FunctionDescription
createWindowedCounterCreates the windowed counter that fits the configured infrastructure.

Released under the MIT License.