app/api: add feature to disable cache for some queries
This commit is contained in:
parent
4bc5234d09
commit
e0d2836f4a
@ -1,3 +1,4 @@
|
||||
export const queryTTL: Record<string, number> = {
|
||||
export const queryTTL: Record<string, number | false> = {
|
||||
GetLeads: false,
|
||||
GetSystemUser: 6 * 60 * 60,
|
||||
};
|
||||
|
||||
@ -31,10 +31,9 @@ export class ProxyController {
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
if (data) {
|
||||
const ttl = queryTTL[operationName] || env.CACHE_TTL;
|
||||
await this.cacheManager.set(key, data, { ttl });
|
||||
}
|
||||
const ttl = queryTTL[operationName];
|
||||
if (data && ttl !== false)
|
||||
await this.cacheManager.set(key, data, { ttl: ttl || env.CACHE_TTL });
|
||||
|
||||
return reply.send(data);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user