A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
feat: add redis cache channel
Meier Lukase05deef6e28c
diff --git a/packages/redis/src/lib/channel.ts b/packages/redis/src/lib/channel.tsindex a80a8fb19..bb41f10cc 100644--- a/packages/redis/src/lib/channel.ts+++ b/packages/redis/src/lib/channel.ts@@ -53,6 +53,34 @@ export const createSubPubChannel = <TData>(name: string) => {};};+const cacheClient = createRedisConnection();++/**+ * Creates a new cache channel.+ * @param name name of the channel+ * @returns cache channel object+ */+export const createCacheChannel = <TData>(name: string) => {+ const cacheChannelName = `cache:${name}`;+ return {+ /**+ * Get the data from the cache channel.+ * @returns data or undefined if not found+ */+ getAsync: async () => {+ const data = await cacheClient.get(cacheChannelName);+ return data ? superjson.parse<TData>(data) : undefined;+ },+ /**+ * Set the data in the cache channel.+ * @param data data to be stored in the cache channel+ */+ setAsync: async (data: TData) => {+ await cacheClient.set(cacheChannelName, superjson.stringify(data));+ },+ };+};+const queueClient = createRedisConnection();type WithId<TItem> = TItem & { _id: string };