bentocache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
62 lines (59 loc) • 1.77 kB
TypeScript
import { BaseDriver } from '../base_driver.js';
import { C as CacheDriver, D as DatabaseAdapter } from '../../../driver-CldynQv4.js';
import { b as DatabaseConfig } from '../../../drivers_options-Dm62iGEe.js';
import 'knex';
import 'kysely';
import '@aws-sdk/client-dynamodb';
import 'ioredis';
import 'orchid-orm';
/**
* A store that use a database to store cache entries
*
* You should provide an adapter that will handle the database interactions
*/
declare class DatabaseDriver extends BaseDriver implements CacheDriver<true> {
#private;
type: "l2";
constructor(adapter: DatabaseAdapter, config: DatabaseConfig, isNamespace?: boolean);
/**
* Returns a new instance of the driver namespaced
*/
namespace(namespace: string): any;
/**
* Get a value from the cache
*/
get(key: string): Promise<any>;
/**
* Get the value of a key and delete it
*
* Returns the value if the key exists, undefined otherwise
*/
pull(key: string): Promise<string | undefined>;
/**
* Set a value in the cache
* Returns true if the value was set, false otherwise
*/
set(key: string, value: any, ttl?: number): Promise<boolean>;
/**
* Check if a key exists in the cache
*/
has(key: string): Promise<boolean>;
/**
* Remove all items from the cache
*/
clear(): Promise<void>;
/**
* Delete a key from the cache
* Returns true if the key was deleted, false otherwise
*/
delete(key: string): Promise<boolean>;
/**
* Delete multiple keys from the cache
*/
deleteMany(keys: string[]): Promise<boolean>;
/**
* Disconnect from the database
*/
disconnect(): Promise<void>;
}
export { DatabaseDriver };