UNPKG

mastercache

Version:

Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers

70 lines (67 loc) 2.16 kB
import { CacheEntry } from '../cache-entry/cache-entry.js'; import { L as L1CacheDriver } from '../../../mastercache-Di19srNZ.js'; import { CacheEntryOptions } from '../cache-entry/cache-entry-options.js'; import { Logger } from 'typescript-log'; import '../../types/driver.js'; import '../../types/provider.js'; import '../../types/helpers.js'; import '../../types/options/methods-options.js'; import '../../types/options/options.js'; import '../../../events-CkqPK7En.js'; import '../../types/bus.js'; import '@boringnode/bus/types/main'; import '../../types/options/drivers-options.js'; import 'knex'; import 'kysely'; import '@aws-sdk/client-dynamodb'; import 'ioredis'; import 'orchid-orm'; /** * LocalCache is a wrapper around a CacheDriver that provides a * some handy methods for interacting with a local cache ( in-memory ) */ declare class LocalCache { #private; constructor(driver: L1CacheDriver, logger: Logger); /** * Get an item from the local cache */ get(key: string, options: CacheEntryOptions): CacheEntry | undefined; /** * Set a new item in the local cache */ set(key: string, value: string, options: CacheEntryOptions): boolean | undefined; /** * Delete an item from the local cache */ delete(key: string, options?: CacheEntryOptions): boolean; /** * Make an item logically expire in the local cache * * That means that the item will be expired but kept in the cache * in order to be able to return it to the user if the remote cache * is down and the grace period is enabled */ logicallyExpire(key: string): boolean | undefined; /** * Delete many item from the local cache */ deleteMany(keys: string[], options: CacheEntryOptions): void; /** * Create a new namespace for the local cache */ namespace(namespace: string): L1CacheDriver; /** * Check if an item exists in the local cache */ has(key: string): boolean; /** * Clear the local cache */ clear(): void; /** * Disconnect from the local cache */ disconnect(): void; } export { LocalCache };