RedisAdapter
@tsed/adapters-redis
Usage
typescript
import { RedisAdapter } from "@tsed/adapters-redis";
See /packages/orm/adapters-redis/src/types/adapters/RedisAdapter.ts.
Overview
ts
class RedisAdapter<Model extends AdapterModel> extends Adapter<Model> {
protected configuration: Configuration;
readonly hooks: Hooks;
readonly connectionName: string;
readonly connection: IORedis;
protected useHash: boolean;
constructor(options: RedisAdapterConstructorOptions, connections: IORedis[], configuration: Configuration);
get db(): Redis;
key(id: string): string;
create(payload: Partial<Model>, expiresAt?: Date): Promise<Model>;
upsert(id: string, payload: Model, expiresAt?: Date): Promise<Model>;
update(id: string, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
updateOne(predicate: Partial<Model & any>, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
findOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
findById(_id: string): Promise<Model | undefined>;
findAll(predicate?: Partial<Model & any>): Promise<Model[]>;
deleteOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
deleteById(_id: string): Promise<Model | undefined>;
deleteMany(predicate: Partial<Model>): Promise<Model[]>;
protected findKeys(props: any): Promise<string[]>;
protected insert(payload: Partial<Model>, expiresAt?: Date): Promise<any>;
protected getAllIndex(id: string): Promise<string[]>;
protected getAllIndex(id: string, pipeline: ChainableCommander): ChainableCommander;
protected getIndexedKey(id: string, propertyKey: string, value: any): string;
protected getAll(): Promise<Model[]>;
protected findAllBy(props: Partial<Model & any>): Promise<Model[]>;
}
protected configuration
ts
protected configuration: Configuration;
readonly hooks
ts
readonly hooks: Hooks;
readonly connectionName
ts
readonly connectionName: string;
readonly connection
ts
readonly connection: IORedis;
protected useHash
ts
protected useHash: boolean;
get db
ts
get db(): Redis;
key
ts
key(id: string): string;
create
ts
create(payload: Partial<Model>, expiresAt?: Date): Promise<Model>;
upsert
ts
upsert(id: string, payload: Model, expiresAt?: Date): Promise<Model>;
update
ts
update(id: string, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
updateOne
ts
updateOne(predicate: Partial<Model & any>, payload: Model, expiresAt?: Date): Promise<Model | undefined>;
findOne
ts
findOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
findById
ts
findById(_id: string): Promise<Model | undefined>;
findAll
ts
findAll(predicate?: Partial<Model & any>): Promise<Model[]>;
deleteOne
ts
deleteOne(predicate: Partial<Model & any>): Promise<Model | undefined>;
deleteById
ts
deleteById(_id: string): Promise<Model | undefined>;
deleteMany
ts
deleteMany(predicate: Partial<Model>): Promise<Model[]>;
protected findKeys
ts
protected findKeys(props: any): Promise<string[]>;
protected insert
ts
protected insert(payload: Partial<Model>, expiresAt?: Date): Promise<any>;
protected getAllIndex
ts
protected getAllIndex(id: string): Promise<string[]>;
protected getAllIndex
ts
protected getAllIndex(id: string, pipeline: ChainableCommander): ChainableCommander;
protected getIndexedKey
ts
protected getIndexedKey(id: string, propertyKey: string, value: any): string;
protected getAll
ts
protected getAll(): Promise<Model[]>;
protected findAllBy
ts
protected findAllBy(props: Partial<Model & any>): Promise<Model[]>;