feat: add image-proxy key ttl and shared http dispatcher
This commit is contained in:
1 parent
3ff0d72ba1
commit
e1ff84830f
3 files changed
+69
-11
No files matched your search
@@ -113,8 +113,14 @@ export const createGetSetChannel = <TData>(name: string) => {
|
||||
* Set data in the channel
|
||||
* @param data data to be stored in the channel
|
||||
*/
|
||||
setAsync: async (data: TData) => {
|
||||
await getSetClient.set(name, superjson.stringify(data));
|
||||
setAsync: async (data: TData, options?: { ttlSeconds?: number }) => {
|
||||
const ttlSeconds = options?.ttlSeconds;
|
||||
const serializedData = superjson.stringify(data);
|
||||
if (ttlSeconds && ttlSeconds > 0) {
|
||||
await getSetClient.set(name, serializedData, "EX", Math.ceil(ttlSeconds));
|
||||
return;
|
||||
}
|
||||
await getSetClient.set(name, serializedData);
|
||||
},
|
||||
/**
|
||||
* Remove data from the channel
|
||||
|
||||
Reference in new issue
Block a user