tune cache lifetimes
This commit is contained in:
parent
3688f1dadf
commit
672f1ea684
8 changed files with 16 additions and 18 deletions
|
@ -135,7 +135,7 @@ export class NodeinfoServerService {
|
|||
return document;
|
||||
};
|
||||
|
||||
const cache = new MemorySingleCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10);
|
||||
const cache = new MemorySingleCache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10); // 10s
|
||||
|
||||
fastify.get(nodeinfo2_1path, async (request, reply) => {
|
||||
const base = await cache.fetch(() => nodeinfo2(21));
|
||||
|
|
|
@ -38,8 +38,8 @@ export class UrlPreviewService {
|
|||
) {
|
||||
this.logger = this.loggerService.getLogger('url-preview');
|
||||
this.previewCache = new RedisKVCache<SummalyResult>(this.redisClient, 'summaly', {
|
||||
lifetime: 1000 * 86400,
|
||||
memoryCacheLifetime: 1000 * 10 * 60,
|
||||
lifetime: 1000 * 60 * 60 * 24, // 1d
|
||||
memoryCacheLifetime: 1000 * 60 * 10, // 10m
|
||||
fetcher: (key: string) => { throw new Error('the UrlPreview cache should never fetch'); },
|
||||
toRedisConverter: (value) => JSON.stringify(value),
|
||||
fromRedisConverter: (value) => JSON.parse(value),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue