* @internal
(
config: boolean | number | [string, number] | undefined,
key: { key: string },
data: T | (() => T),
)
| 3178 | * @internal |
| 3179 | */ |
| 3180 | async storeCache<T>( |
| 3181 | config: boolean | number | [string, number] | undefined, |
| 3182 | key: { key: string }, |
| 3183 | data: T | (() => T), |
| 3184 | ) { |
| 3185 | config ??= this.config.get('resultCache').global; |
| 3186 | |
| 3187 | if (config) { |
| 3188 | const em = this.getContext(); |
| 3189 | const expiration = Array.isArray(config) ? config[1] : typeof config === 'number' ? config : undefined; |
| 3190 | await em.#resultCache.set(key.key, data instanceof Function ? data() : data, '', expiration); |
| 3191 | } |
| 3192 | } |
| 3193 | |
| 3194 | /** |
| 3195 | * Clears result cache for given cache key. If we want to be able to call this method, |