bentocache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
68 lines (65 loc) • 1.86 kB
TypeScript
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { BaseDriver } from './base_driver.js';
import { DynamoDBConfig, CreateDriverResult, CacheDriver } from '../types/main.js';
import '@poppinss/exception';
import '@boringnode/bus/types/main';
import '@julr/utils/logger';
import 'knex';
import 'kysely';
import 'orchid-orm';
import 'ioredis';
/**
* Create a new DynamoDB driver
*/
declare function dynamoDbDriver(options: DynamoDBConfig): CreateDriverResult<DynamoDbDriver>;
/**
* Caching driver for DynamoDB
*/
declare class DynamoDbDriver extends BaseDriver implements CacheDriver {
#private;
type: "l2";
/**
* Configuration
*/
config: DynamoDBConfig;
constructor(config: DynamoDBConfig & {
client?: DynamoDBClient;
});
/**
* Returns a new instance of the driver with the given namespace.
*/
namespace(namespace: string): DynamoDbDriver;
/**
* Get a value from the cache
*/
get(key: string): Promise<string | undefined>;
/**
* Get the value of a key and delete it
*
* Returns the value if the key exists, undefined otherwise
*/
pull(key: string): Promise<string | undefined>;
/**
* Put a value in the cache
* Returns true if the value was set, false otherwise
*/
set(key: string, value: string, ttl?: number): 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>;
/**
* Closes the connection to the cache
*/
disconnect(): Promise<void>;
}
export { DynamoDbDriver, dynamoDbDriver };