Files
calendar/packages/features/redis/NoopRedisService.ts
T
b71d8baccc chore: Implement short-lived redis cache for slots (#22787)
* chore: Implement short-lived redis cache for slots

* chore: adapt apiv2 redis service to match with upstash redis

* chore: safer redis service and ms ttl

* fixup! chore: safer redis service and ms ttl

* Wrap with timeout, currently doesn't work yet

* Updated @upstash/redis for better signal support

* Fix type errors, remove ts value

* Inject NoopRedisService for NODE_ENV test

* chore: bump platform libs

* chore: bump platform libs

* Upstash Redis upgrade no longer resulted in expected hard crash on init, so updated factory and our Upstash Redis Adapter to mimick old behaviour

* Add SLOTS_CACHE_TTL variable for configurable ttl on slots cache

* Update parseInt to use right types

* chore: bump platform libs

* chore: bump platform libs

* chore: bump platform libs

* update e2e api v2 action

* set SLOTS_CACHE_TTL env var api v2 e2e

---------

Co-authored-by: cal.com <morgan@cal.com>
2025-08-05 17:32:02 +00:00

33 lines
835 B
TypeScript

import type { IRedisService } from "./IRedisService";
/**
* Noop implementation of IRedisService for testing or fallback scenarios.
*/
export class NoopRedisService implements IRedisService {
async get<TData>(_key: string): Promise<TData | null> {
return null;
}
async del(_key: string): Promise<number> {
return 0;
}
async set<TData>(_key: string, _value: TData, _opts?: { ttl?: number }): Promise<"OK" | TData | null> {
return "OK";
}
async expire(_key: string, _seconds: number): Promise<0 | 1> {
// Implementation for setting expiration time for key in Redis
return 0;
}
async lrange<TResult = string>(_key: string, _start: number, _end: number): Promise<TResult[]> {
return [];
}
async lpush<TData>(_key: string, ..._elements: TData[]): Promise<number> {
return 0;
}
}