@nhtio/lucid-resourceful/private/utils/cache_service_resolver
Resolves the cache service used for relation caching via a precedence chain (per-model relationsCacheService option → process-wide default → none) and exposes the package-level default registration setter.
Type Aliases
| Type Alias | Description |
|---|---|
| CacheDuration | A cache TTL/duration as understood by the underlying cache service. |
| CacheServiceLike | The cache service the relation cache talks to. |
| RelationCacheEntryOptions | Per-relation (and model-level) cache entry options. |
| RelationsCacheServiceResolver | Resolver supplied by the host that returns the cache service for a model, or null to opt that model out of relation caching. |
Functions
| Function | Description |
|---|---|
| getDefaultRelationsCacheService | Reads the currently-registered default resolver (used internally and by the write-through eviction hook). Exposed for completeness; prefer resolveRelationsCacheService. |
| isRelationCacheTarget | Reports whether a model identity name is a registered relation-cache TARGET, i.e. some model caches a 1:1 relation pointing at this model. |
| registerRelationCacheTarget | Registers a related-model identity name as a relation-cache TARGET. Idempotent. |
| resetRelationCacheTargets | Clears the registered relation-cache target set. Test-only hook: the set is module-scoped and accumulates across a process, which can mask regressions between tests. Hosts must NOT call this at runtime. |
| resolveRelationsCacheService | Resolves the cache service for a model via the precedence chain: per-model resolver → process-wide default → null (uncached). |
| setDefaultRelationsCacheService | Registers (or clears) the process-wide default relation cache resolver. |