/** * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * @author Chill */ /** * 缓存包装:命中直接返,未命中调 factory 并缓存。 * @param key 缓存键 * @param ttlMs 本次缓存 TTL(毫秒);若 undefined 用默认 5min * @param factory 数据源工厂 */ export declare function withCache(key: string, ttlMs: number | undefined, factory: () => Promise): Promise; /** * 测试用:清空缓存。 */ export declare function clearCache(): void;