Stores
Stores declare cache resources owned by the application. 4.7.0 supports memory, Redis and disk cache implementations. Hazelcast is declared in the enum but is not implemented; storage-store declarations are rejected.
import 'reflect-metadata';
import {Module, Stores, StoreType, CacheClient, type ModuleStore} from '@heronjs/common';
export const memoryCache: ModuleStore = {
type: StoreType.CACHE,
name: 'memory-cache',
isDefault: true,
config: {client: CacheClient.MEMORY, config: {max: 100, ttl: 60000}},
};
@Module({})
@Stores([memoryCache])
export class AppModule {}Use isDefault: true for the store used by default cache behavior. CacheStore.get() returns the framework cache manager if available; handle the optional result before using it. For native Keyv access, import cache from @heronjs/core and acquire using engine = cache() within the application context. Access Keyv through engine.value; TTLs are milliseconds. Disposing the lease does not close the application-owned cache.
The application registers cache resources in its container and owns disconnection. await app.close() waits for cleanup. See Caching for route caching and eviction.