UNPKG

@imqueue/rpc

Version:

RPC-like client-service implementation over messaging queue

63 lines (62 loc) 2.19 kB
/*! * IMQCache implementation * * I'm Queue Software Project * Copyright (C) 2025 imqueue.com <support@imqueue.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * * If you want to use this code in a closed source (commercial) project, you can * purchase a proprietary commercial license. Please contact us at * <support@imqueue.com> to get commercial licensing options. */ import { ICache, ICacheAdapter } from '.'; /** * Generic cache registry */ export declare class IMQCache { private static options; static adapters: { [name: string]: ICache; }; /** * Registers given cache adapter * * @param { ICache | string} adapter - adapter name or class or instance * @param {any} options - adapter specific options * @returns {IMQCache} */ static register(adapter: ICacheAdapter | string, options?: any): typeof IMQCache; /** * Overrides existing adapter options with the given * * @param {ICache | string} adapter - adapter to apply options to * @param {any} options - adapter specific options * @returns {IMQCache} */ static apply(adapter: ICacheAdapter | string, options: any): typeof IMQCache; /** * Initializes all registered cache adapters * * @returns {Promise<any>} */ static init(): Promise<any>; /** * Returns registered cache adapter by its given name or class * * @param { ICache | string} adapter - adapter name or class * @returns {ICache} - adapter instance */ static get(adapter: ICacheAdapter): ICache; }