UNPKG

@zenweb/cache

Version:
20 lines (19 loc) 438 B
import { callProxy, $getCore } from "@zenweb/core"; import { CacheHelper } from "./helper.js"; /** * 取得缓存实例 */ export function $getCache() { const ins = $getCore(); return ins.cache2; } /** * 快捷方法 - 缓存实例 */ export const $cache = callProxy($getCache); /** * 快捷方法 - 缓存助手 */ export function $cacheHelper(key, fetch, opt) { return new CacheHelper($getCache(), key, fetch, opt); }