mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
Redis sets expiry time
This commit is contained in:
parent
7dab7dc190
commit
cf07f93244
4
src/cache/RedisQueryResultCache.ts
vendored
4
src/cache/RedisQueryResultCache.ts
vendored
@ -105,13 +105,13 @@ export class RedisQueryResultCache implements QueryResultCache {
|
||||
async storeInCache(options: QueryResultCacheOptions, savedCache: QueryResultCacheOptions, queryRunner?: QueryRunner): Promise<void> {
|
||||
return new Promise<void>((ok, fail) => {
|
||||
if (options.identifier) {
|
||||
this.client.set(options.identifier, JSON.stringify(options), (err: any, result: any) => {
|
||||
this.client.set(options.identifier, JSON.stringify(options), 'PX', options.duration, (err: any, result: any) => {
|
||||
if (err) return fail(err);
|
||||
ok();
|
||||
});
|
||||
|
||||
} else if (options.query) {
|
||||
this.client.set(options.query, JSON.stringify(options), (err: any, result: any) => {
|
||||
this.client.set(options.query, JSON.stringify(options), 'PX', options.duration, (err: any, result: any) => {
|
||||
if (err) return fail(err);
|
||||
ok();
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user