Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/typeorm/src/cache/RedisQueryResultCache.ts>RedisQueryResultCache

Forked from https://github.com/typeorm/typeorm
Latest
class RedisQueryResultCache
implements QueryResultCache
import { RedisQueryResultCache } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/cache/RedisQueryResultCache.ts";

Caches query result into Redis database.

Constructors

new
RedisQueryResultCache(connection: Connection, clientType: "redis" | "ioredis" | "ioredis/cluster")

Properties

protected
client: any

Connected redis client.

protected
clientType: "redis" | "ioredis" | "ioredis/cluster"

Type of the Redis Client (redis or ioredis).

protected
redis: any

Redis module instance loaded dynamically.

Methods

protected
deleteKey(key: string): Promise<void>

Removes a single key from redis database.

protected
loadRedis(): any

Loads redis dependency.

clear(queryRunner?: QueryRunner): Promise<void>

Clears everything stored in the cache.

connect(): Promise<void>

Creates a connection with given cache provider.

disconnect(): Promise<void>

Disconnects the connection

getFromCache(options: QueryResultCacheOptions, queryRunner?: QueryRunner): Promise<QueryResultCacheOptions | undefined>

Caches given query result. Returns cache result if found. Returns undefined if result is not cached.

isExpired(savedCache: QueryResultCacheOptions): boolean

Checks if cache is expired or not.

remove(identifiers: string[], queryRunner?: QueryRunner): Promise<void>

Removes all cached results by given identifiers from cache.

storeInCache(
options: QueryResultCacheOptions,
savedCache: QueryResultCacheOptions,
queryRunner?: QueryRunner,
): Promise<void>

Stores given query result in the cache.

synchronize(queryRunner: QueryRunner): Promise<void>

Creates table for storing cache if it does not exist yet.