fix: demo cache key prefix
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { isInDemoMode } from '~/app.config'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
|
||||
type Prefix = 'mx' | 'mx-demo'
|
||||
const prefix = isInDemoMode ? 'mx-demo' : 'mx'
|
||||
|
||||
export const getRedisKey = <T extends string = RedisKeys | '*'>(
|
||||
key: T,
|
||||
...concatKeys: string[]
|
||||
): `mx:${T}${string | ''}` => {
|
||||
return `mx:${key}${
|
||||
): `${Prefix}:${T}${string | ''}` => {
|
||||
return `${prefix}:${key}${
|
||||
concatKeys && concatKeys.length ? `:${concatKeys.join('_')}` : ''
|
||||
}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user