Skip to content

PlatformCacheOptions

@tsed/platform-cache

Usage

typescript
import { PlatformCacheOptions } from "@tsed/platform-cache";

See /packages/platform/platform-cache/src/types/interfaces/PlatformCacheOptions.ts.

Overview

ts
interface PlatformCacheOptions extends MetadataTypes {
    ttl?: Ttl;
    prefix?: string;
    key?: string | ((args: any[], ctx?: BaseContext) => string);
    refreshThreshold?: number;
    canCache?: ((item: any) => boolean) | "no-nullish";
}

ttl

ts
ttl?: Ttl;

key expiration ttl in seconds.

prefix

ts
prefix?: string;

By default, the key is generated from the method name and the arguments passed to the method.

key: string |

ts
key?: string | ((args: any[], ctx?: BaseContext) => string);

Algorithm used to generate the key. By default, the key is generated from the method name and the arguments passed to the method.

refreshThreshold

ts
refreshThreshold?: number;

threshold to refresh the cache.

canCache:

ts
canCache?: ((item: any) => boolean) | "no-nullish";

The function determine if the result must be cached or not.

Released under the MIT License.