mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
70 lines (67 loc) • 2.17 kB
text/typescript
import { CacheEntry } from '../cache-entry/cache-entry.cjs';
import { L as L1CacheDriver } from '../../../mastercache-CD6UEBYT.cjs';
import { CacheEntryOptions } from '../cache-entry/cache-entry-options.cjs';
import { Logger } from 'typescript-log';
import '../../types/driver.cjs';
import '../../types/provider.cjs';
import '../../types/helpers.cjs';
import '../../types/options/methods-options.cjs';
import '../../types/options/options.cjs';
import '../../../events-BJQnbTp3.cjs';
import '../../types/bus.cjs';
import '@boringnode/bus/types/main';
import '../../types/options/drivers-options.cjs';
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 };