Files
speckle-server/packages/server/test/redisHelper.ts
T
Kristaps Fabians Geikins 954b1a9f11 feat: plan prices accurately read from Stripe (#4104)
* WIP prices + new caching utils

* cached workspace plan prices

* GQL API done

* integrated in frontend

* fixed missing FF

* CR fixes

* integration tests

* removed non-existant team yearly env var
2025-03-05 12:23:38 +02:00

24 lines
661 B
TypeScript

import { redisCacheProviderFactory } from '@/modules/shared/utils/caching'
import { Optional } from '@speckle/shared'
import Redis from 'ioredis'
import MockRedis from 'ioredis-mock'
let client: Optional<Redis> = undefined
const createMockRedis = () => new MockRedis() as unknown as Redis
export function getInmemoryRedisClient(): Redis {
if (!client) {
client = createMockRedis()
}
return client
}
export const mockRedisCacheProviderFactory = (
options?: Partial<{ createNewCache: boolean }>
) => {
const client = options?.createNewCache ? createMockRedis() : getInmemoryRedisClient()
return redisCacheProviderFactory({ redis: client })
}