Skip to content

Commit

Permalink
chore: Connect Redis client on initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sasicodes committed Jul 21, 2024
1 parent 47ef2ce commit ca3ca08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/helpers/server/db/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ const redisClient: RedisClientType = createClient({
url: process.env.REDIS_URL!
})

const connectRedis = async () => {
await redisClient.connect()
}

if (redisClient) {
connectRedis()
}

const rSave = async (key: string, value: string): Promise<void> => {
await redisClient.rPush(key, value)
}

const rLoad = async (
key: string,
start: number = 0,
Expand Down

0 comments on commit ca3ca08

Please sign in to comment.