Function: resolveRelationsCacheService()
ts
function resolveRelationsCacheService(
model: LucidModel,
perModelResolver?: RelationsCacheServiceResolver,
): Promise<CacheServiceLike | null>;Resolves the cache service for a model via the precedence chain: per-model resolver → process-wide default → null (uncached).
Returns null only when the selected resolver itself returns null (an intentional opt-out). If the selected resolver throws or fails to acquire the cache, the error propagates — callers on the read path must fail loud, while the write-through hook guards this call to stay best-effort (ADR-007). Resolved instances are memoized per model; a premature null is never cached.
Parameters
| Parameter | Type | Description |
|---|---|---|
model | LucidModel | The Lucid model whose cache service should be resolved. |
perModelResolver? | RelationsCacheServiceResolver | The model's own relationsCacheService option, if any. |
Returns
Promise<CacheServiceLike | null>
The resolved cache service, or null when caching is opted out.