ltijs
Version:
Easily turn your web application into a LTI 1.3 Learning Tool.
25 lines (24 loc) • 1.3 kB
TypeScript
import type { CacheManager } from '#services/cache-manager/cache-manager.types';
import type { Logger } from '#services/logger/logger.types';
import type { RedisConnectionConfig } from '#services/cache-manager/redis/redis-cache-manager.types';
/**
* A `CacheManager` backed by Redis -- the opt-in choice for real, cross-instance-coordinated caching
* (the default `MockCacheManager` is a no-op, since a per-process cache can't stay consistent across
* multiple ltijs instances behind a load balancer). Not constructed by `Provider` automatically; import
* it, construct it, and pass it as `ProviderOptions.cacheManager`, the same way `MongoLegacyDatabaseManager`
* is opted into.
*/
export declare class RedisCacheManager implements CacheManager {
private readonly LOG_COMPONENT;
private readonly PX_OPTION;
private readonly client;
private readonly logger;
/** Throws `MissingCacheConfigError` if `config` is missing or `config.url` is empty. */
constructor(logger: Logger, config: RedisConnectionConfig);
listen(): Promise<void>;
close(): Promise<void>;
get<T = unknown>(key: string): Promise<T | undefined>;
set<T = unknown>(key: string, value: T, ttlMs: number): Promise<void>;
delete(key: string): Promise<void>;
}
export default RedisCacheManager;