cacheBy() function

Decorator factory @cacheBy(Model, CacheByOptions) This decorator should be used on a service methods, to set the caching rules for a method. Caching rules within this decorator are defined by a passed model, which is treated as a root model of the call and it analyzes cache invalidation based on passed runtime fields arguments, which prevents unnecessary cache invalidations. So it is more intellectual way to invalidate cache instead of any changes on described list of tables.

Signature:

export declare function cacheBy(model: typeof Model, options?: CacheByOptions): MethodDecorator;

Parameters

Parameter

Type

Description

model

typeof Model

options

CacheByOptions

(Optional)

Returns:

MethodDecorator

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.