Skip to content

Commit f1e3dde

Browse files
committed
Honor cache expiration from ctor if not passed explicitly
1 parent a820f3b commit f1e3dde

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

RepoDb.Core/RepoDb/DbRepository.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public IEnumerable<dynamic> ExecuteQuery(string commandText,
368368
object param = null,
369369
CommandType? commandType = null,
370370
string cacheKey = null,
371-
int? cacheItemExpiration = Constant.DefaultCacheItemExpirationInMinutes,
371+
int? cacheItemExpiration = null,
372372
IDbTransaction transaction = null)
373373
{
374374
// Create a connection
@@ -381,7 +381,7 @@ public IEnumerable<dynamic> ExecuteQuery(string commandText,
381381
param: param,
382382
commandType: commandType,
383383
cacheKey: cacheKey,
384-
cacheItemExpiration: cacheItemExpiration,
384+
cacheItemExpiration: cacheItemExpiration ?? CacheItemExpiration,
385385
commandTimeout: CommandTimeout,
386386
transaction: transaction,
387387
cache: Cache);
@@ -420,7 +420,7 @@ public async Task<IEnumerable<dynamic>> ExecuteQueryAsync(string commandText,
420420
object param = null,
421421
CommandType? commandType = null,
422422
string cacheKey = null,
423-
int? cacheItemExpiration = Constant.DefaultCacheItemExpirationInMinutes,
423+
int? cacheItemExpiration = null,
424424
IDbTransaction transaction = null,
425425
CancellationToken cancellationToken = default)
426426
{
@@ -434,7 +434,7 @@ public async Task<IEnumerable<dynamic>> ExecuteQueryAsync(string commandText,
434434
param: param,
435435
commandType: commandType,
436436
cacheKey: cacheKey,
437-
cacheItemExpiration: cacheItemExpiration,
437+
cacheItemExpiration: cacheItemExpiration ?? CacheItemExpiration,
438438
commandTimeout: CommandTimeout,
439439
transaction: transaction,
440440
cache: Cache,
@@ -474,7 +474,7 @@ public IEnumerable<TEntity> ExecuteQuery<TEntity>(string commandText,
474474
object param = null,
475475
CommandType? commandType = null,
476476
string cacheKey = null,
477-
int? cacheItemExpiration = Constant.DefaultCacheItemExpirationInMinutes,
477+
int? cacheItemExpiration = null,
478478
IDbTransaction transaction = null)
479479
where TEntity : class
480480
{
@@ -488,7 +488,7 @@ public IEnumerable<TEntity> ExecuteQuery<TEntity>(string commandText,
488488
param: param,
489489
commandType: commandType,
490490
cacheKey: cacheKey,
491-
cacheItemExpiration: cacheItemExpiration,
491+
cacheItemExpiration: cacheItemExpiration ?? CacheItemExpiration,
492492
commandTimeout: CommandTimeout,
493493
transaction: transaction,
494494
cache: Cache);
@@ -528,7 +528,7 @@ public async Task<IEnumerable<TEntity>> ExecuteQueryAsync<TEntity>(string comman
528528
object param = null,
529529
CommandType? commandType = null,
530530
string cacheKey = null,
531-
int? cacheItemExpiration = Constant.DefaultCacheItemExpirationInMinutes,
531+
int? cacheItemExpiration = null,
532532
IDbTransaction transaction = null,
533533
CancellationToken cancellationToken = default)
534534
where TEntity : class
@@ -543,7 +543,7 @@ public async Task<IEnumerable<TEntity>> ExecuteQueryAsync<TEntity>(string comman
543543
param: param,
544544
commandType: commandType,
545545
cacheKey: cacheKey,
546-
cacheItemExpiration: cacheItemExpiration,
546+
cacheItemExpiration: cacheItemExpiration ?? CacheItemExpiration,
547547
commandTimeout: CommandTimeout,
548548
transaction: transaction,
549549
cache: Cache,

0 commit comments

Comments
 (0)