mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-25 13:43:34 +08:00
Share workspace packages between Ray Admin and the interactive docs. BREAKING CHANGE: v6 is a new major line. v5 stays on legacy/v5.
26 lines
532 B
TypeScript
26 lines
532 B
TypeScript
import { APP_CATCH_KEY_PREFIX } from '@/app-config'
|
|
|
|
export interface PrefixCacheKeyOptions {
|
|
customPrefix?: string
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param key 原始缓存键
|
|
* @param options 可覆盖默认前缀;前缀需包含所需分隔符
|
|
*
|
|
* @returns 直接拼接前缀和原始键后的结果。
|
|
*/
|
|
export const prefixCacheKey = (
|
|
key: string,
|
|
options?: PrefixCacheKeyOptions,
|
|
) => {
|
|
const { customPrefix } = options ?? {}
|
|
|
|
if (customPrefix) {
|
|
return `${customPrefix}${key}`
|
|
}
|
|
|
|
return `${APP_CATCH_KEY_PREFIX}${key}`
|
|
}
|