Skip to content

Commit

Permalink
[keyserver] Lazily initiate Redis connection in RedisCache
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashoat committed Oct 10, 2024
1 parent f8cd12f commit 42f8f31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions keyserver/src/utils/redis-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import type { NeynarChannel } from 'lib/types/farcaster-types.js';
import { redisConfig } from '../socket/redis.js';

class RedisCache {
cacheClient: RedisClient;
_cacheClient: ?RedisClient;

constructor() {
this.cacheClient = redis.createClient(redisConfig);
get cacheClient(): RedisClient {
if (!this._cacheClient) {
this._cacheClient = redis.createClient(redisConfig);
}
return this._cacheClient;
}

setChannelInfo(fcChannelID: string, fcChannel: NeynarChannel): Promise<void> {
Expand Down

0 comments on commit 42f8f31

Please sign in to comment.