/*!
* @Author: richen
* @Date: 2026-04-24 16:20:38
* @License: BSD (3-Clause)
* @Copyright (c) - <richenlin(at)gmail.com>
* @HomePage: https://koatty.org/
*/
import { CacheStore } from 'koatty_store';
import { Koatty } from 'koatty_core';
import { StoreOptions } from 'koatty_store';

/**
 * Decorate this method to support caching.
 * The cache method returns a value to ensure that the next time
 * the method is executed with the same parameters, the results can be obtained
 * directly from the cache without the need to execute the method again.
 * CacheStore server config defined in db.ts.
 *
 * @export
 * @param {string} cacheName cache name
 * @param {CacheAbleOpt} [opt] cache options
 * e.g:
 * {
 *  params: ["id"],
 *  timeout: 30
 * }
 * Use the 'id' parameters of the method as cache subkeys, the cache expiration time 30s
 * @returns {MethodDecorator}
 */
export declare function CacheAble(cacheName: string, opt?: CacheAbleOpt): (...args: any[]) => any;

/**
 * @description:
 * @return {*}
 */
export declare interface CacheAbleOpt {
    params?: string[];
    timeout?: number;
}

/**
 * Decorating the execution of this method will trigger a cache clear operation.
 * CacheStore server config defined in db.ts.
 *
 * @export
 * @param {string} cacheName cacheName cache name
 * @param {CacheEvictOpt} [opt] cache options
 * e.g:
 * {
 *  params: ["id"],
 *  delayedDoubleDeletion: true
 * }
 * Use the 'id' parameters of the method as cache subkeys,
 *  and clear the cache after the method executed
 * @returns
 */
export declare function CacheEvict(cacheName: string, opt?: CacheEvictOpt): (...args: any[]) => any;

/**
 * @description:
 * @return {*}
 */
export declare interface CacheEvictOpt {
    params?: string[];
    delayedDoubleDeletion?: boolean;
    delayTime?: number;
}

/**
 * Close cache store connection for cleanup (mainly for testing)
 */
export declare function CloseCacheStore(): Promise<void>;

/**
 * get instances of storeCache
 *
 * @export
 * @param {StoreOptions} options
 * @returns {*}  {CacheStore}
 */
export declare function GetCacheStore(options?: StoreOptions): Promise<CacheStore>;

/**
 * @param options - The options for the cached options
 * @param app - The Koatty application instance
 */
export declare function KoattyCached(options: StoreOptions, app: Koatty): Promise<void>;

export { }
