UNPKG

1.76 kBTypeScriptView Raw
1/**
2 * This file is part of the @egodigital/egoose distribution.
3 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
4 *
5 * @egodigital/egoose is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation, version 3.
8 *
9 * @egodigital/egoose is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17import { CacheBase, SetCacheValueOptions } from './index';
18/**
19 * Options for redis cache (client).
20 */
21export interface RedisCacheOptions {
22 /**
23 * The custom host.
24 */
25 host?: string;
26 /**
27 * The custom TCP port.
28 */
29 port?: number;
30}
31/**
32 * A Redis cache (client).
33 */
34export declare class RedisCache extends CacheBase {
35 readonly options: RedisCacheOptions;
36 /**
37 * Initializes a new instance of that class.
38 *
39 * @param {RedisCacheOptions} options The options.
40 */
41 constructor(options: RedisCacheOptions);
42 private createClient;
43 /**
44 * Creates a new instance from environment variable.
45 *
46 * @return {RedisCache} The new instance.
47 */
48 static fromEnvironment(): RedisCache;
49 /** @inheritdoc */
50 protected getInner(key: any, defaultValue: any): Promise<any>;
51 /** @inheritdoc */
52 protected setInner(key: any, value: any, opts: SetCacheValueOptions): Promise<void>;
53 private withConnection;
54}