Interface: ProjectCacheOptions
Options for the default project-scoped memory and disk cache.
Extends
Section titled “Extends”Properties
Section titled “Properties”cacheDir?
Section titled “cacheDir?”
readonlyoptionalcacheDir?:string
Override the cache directory, primarily for tests.
cacheId?
Section titled “cacheId?”
optionalcacheId?:string
The cacheId for the cacheable instance. This is primarily used for the wrap function to not have conflicts. If it is not set then it will be a random string that is generated
Inherited from
Section titled “Inherited from”
readonlyoptionaldisk?:boolean
Disable the default disk level. Defaults to true.
diskWriteDelayMs?
Section titled “diskWriteDelayMs?”
readonlyoptionaldiskWriteDelayMs?:number
Delay used by keyv-file to coalesce file rewrites. Defaults to 100 milliseconds.
levels?
Section titled “levels?”
readonlyoptionallevels?: readonlyCacheLevel[]
Additional ordered persistence levels. No levels creates a memory-only cache.
Inherited from
Section titled “Inherited from”ProjectCacheOptions.levels
maxEntries?
Section titled “maxEntries?”
readonlyoptionalmaxEntries?:number
Maximum entries retained in the memory primary. Defaults to 1,000.
Inherited from
Section titled “Inherited from”maxTtl?
Section titled “maxTtl?”
optionalmaxTtl?:string|number
The maximum time-to-live for the cacheable instance. When set, any TTL that exceeds this value
is capped to maxTtl. Entries with no TTL will also be capped to maxTtl.
Can be a number in milliseconds or a human-readable format such as 1s, 1m, 1h, 1d.
Default is undefined (no maximum).
Inherited from
Section titled “Inherited from”namespace?
Section titled “namespace?”
optionalnamespace?:string| (() =>string)
The namespace for the cacheable instance. It can be a string or a function that returns a string.
Inherited from
Section titled “Inherited from”projectName?
Section titled “projectName?”
readonlyoptionalprojectName?:string
Override the project name resolved through projectUtils.name().
stats?
Section titled “stats?”
optionalstats?:boolean
Whether to enable statistics for the cacheable instance
Inherited from
Section titled “Inherited from”
optionaltags?:boolean
Enables the tag service so tag-based invalidation can be used and freshness checks run on
every get / getMany. Tags must be explicitly enabled — while disabled, all tag
operations are no-ops and values set with tags are stored without tag tracking. Enable
this on every instance that shares the store (writers and readers) so invalidations are
honored consistently across distributed instances. Default is false.
Inherited from
Section titled “Inherited from”
optionalttl?:string|number
The time-to-live for the cacheable instance and will be used as the default value.
can be a number in milliseconds or a human-readable format such as 1s for 1 second or 1h for 1 hour
or undefined if there is no time-to-live.
Inherited from
Section titled “Inherited from”useClone?
Section titled “useClone?”
readonlyoptionaluseClone?:boolean
Whether memory reads clone values. Defaults to true.
Inherited from
Section titled “Inherited from”writeDelayMs?
Section titled “writeDelayMs?”
readonlyoptionalwriteDelayMs?:number
Delay used to coalesce persistence mutations. Defaults to 25 milliseconds.