File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
Extensions.Caching.PostgreSql Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public DatabaseExpiredItemsRemoverLoop(
2525 {
2626 var cacheOptions = options . Value ;
2727
28- if ( ( _disabled = cacheOptions . Disabled ) == true )
28+ if ( ( _disabled = cacheOptions . DisableRemoveExpired ) == true )
2929 {
3030 //No need to configure anything
3131 return ;
Original file line number Diff line number Diff line change @@ -43,9 +43,11 @@ public class PostgreSqlCacheOptions : IOptions<PostgreSqlCacheOptions>
4343 public TimeSpan DefaultSlidingExpiration { get ; set ; } = TimeSpan . FromMinutes ( 20 ) ;
4444
4545 /// <summary>
46- /// If set to true this instance of the cache will not remove expired items.
46+ /// If set to true this instance of the cache will not remove expired items.
47+ /// Maybe on multiple instances scenario sharing the same database another instance will be responsable for remove expired itens.
48+ /// Default value is false.
4749 /// </summary>
48- public bool Disabled { get ; set ; }
50+ public bool DisableRemoveExpired { get ; set ; } = false ;
4951
5052 PostgreSqlCacheOptions IOptions < PostgreSqlCacheOptions > . Value => this ;
5153 }
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ services.AddDistributedPostgreSqlCache(setup =>
1717 ConnectionString = configuration [" ConnectionString" ],
1818 SchemaName = configuration [" SchemaName" ],
1919 TableName = configuration [" TableName" ],
20+ RemoveExpiredDisabled = configuration [" RemoveExpiredDisabled" ],
21+ // Optional - RemoveExpiredDisabled default is FALSE
2022 CreateInfrastructure = configuration [" CreateInfrastructure" ]
2123 // CreateInfrastructure is optional, default is TRUE
2224 // This means que every time starts the application the
@@ -65,6 +67,7 @@ Then you can delete the database with:
6567prepare-database.cmd -erase
6668```
6769## Change Log
70+ 1 . v3.0.1 - ` DisableRemoveExpired ` configuration added; If ` TRUE ` the cache instance won`t delete expired items.
68711 . v3.0
6972 1 . [ BREAKING CHANGE] - Direct instantiation not preferred
7073 2 . Single thread loop remover
You can’t perform that action at this time.
0 commit comments