Community.Microsoft.Extensions.Caching.PostgreSql
4.0.2
See the version list below for details.
dotnet add package Community.Microsoft.Extensions.Caching.PostgreSql --version 4.0.2
NuGet\Install-Package Community.Microsoft.Extensions.Caching.PostgreSql -Version 4.0.2
<PackageReference Include="Community.Microsoft.Extensions.Caching.PostgreSql" Version="4.0.2" />
<PackageVersion Include="Community.Microsoft.Extensions.Caching.PostgreSql" Version="4.0.2" />
<PackageReference Include="Community.Microsoft.Extensions.Caching.PostgreSql" />
paket add Community.Microsoft.Extensions.Caching.PostgreSql --version 4.0.2
#r "nuget: Community.Microsoft.Extensions.Caching.PostgreSql, 4.0.2"
#:package Community.Microsoft.Extensions.Caching.PostgreSql@4.0.2
#addin nuget:?package=Community.Microsoft.Extensions.Caching.PostgreSql&version=4.0.2
#tool nuget:?package=Community.Microsoft.Extensions.Caching.PostgreSql&version=4.0.2
Community.Microsoft.Extensions.Caching.PostgreSQL 
Description
This implemantation uses PostgreSQL 11+ as distributed cache. Version 4 and up.
For PostgreSQL ⇐ 10
Use older versions of this packages (<= 3.1.2)
Getting Started
- Install the package into your project
dotnet add package Community.Microsoft.Extensions.Caching.PostgreSql
- Add the following line to the
StartupConfiguremethod.
services.AddDistributedPostgreSqlCache(setup =>
{
setup.ConnectionString = configuration["ConnectionString"];
setup.SchemaName = configuration["SchemaName"];
setup.TableName = configuration["TableName"];
setup.DisableRemoveExpired = configuration["DisableRemoveExpired"];
// Optional - DisableRemoveExpired default is FALSE
setup.CreateInfrastructure = configuration["CreateInfrastructure"];
// CreateInfrastructure is optional, default is TRUE
// This means que every time starts the application the
// creation of table and database functions will be verified.
setup.ExpiredItemsDeletionInterval = TimeSpan.FromMinutes(30)
// ExpiredItemsDeletionInterval is optional
// This is the periodic interval to scan and delete expired items in the cache. Default is 30 minutes.
// Minimum allowed is 5 minutes. - If you need less than this please share your use case 😁, just for curiosity...
})
DisableRemoveExpired = True use case:
When you have 2 or more instances/microservices/processes and you just to leave one of them removing expired items.
- Note 1: This is not mandatory, see if it fits in you cenario.
- Note 2: If you have only one instance and set to
True, all the expired items will not be auto-removed, when you callGetItemthose expired items are filtred out. In that case you are responsable to manually remove the expired key or update it
- Then pull from DI like any other service
/// this is extracted from the React+WebApi WebSample
private readonly IDistributedCache _cache;
public WeatherForecastController(IDistributedCache cache)
{
_cache = cache;
}
What it does to my database 🐘:
It creates a table & schema for storing cache (names are configurable)
Runing the console sample
You will need a local postgresql server with this configuration:
- Server listening to port 5432 at localhost
- The password of your
postgresaccount, if not attached already to your user. - Clone this repo.
- Run the following commands inside
PostgreSqlCacheSample:
dotnet restore
prepare-database.cmd -create
dotnet run
Runing the React+WebApi WebSample project
You will need a local postgresql server with this configuration:
- Server listening to port 5432 at localhost
- The password of your
postgresaccount, if not attached already to your user. - You also need
npmandnodeinstalled on your dev machine - Clone this repo.
- Run the following commands inside
WebSample:
dotnet restore
prepare-database.cmd -create
dotnet run
It takes some time to npm retore the packages, grab a ☕ while waiting...
Then you can delete the database with:
prepare-database.cmd -erase
Change Log
- v4.0.1 - Add suport to .net 7
- [BREAKING CHANGE] - Drop suport to .net 5
- [BREAKING CHANGE] - Make use of procedures (won't work with PostgreSQL ⇐ 10, use version 3)
- v3.1.2 - removed dependency for
IHostApplicationLifetimeif not supported on the platform:AWSfor instance - issue #28 - v3.1.0 - Added log messages on
DebugLevel, multitarget .net5 and .net6, dropped support to netstandard2.0, fix sample to match multitarget and sample database. - v3.0.2 -
CreateInfrastructurealso creates the schema issue #8 - v3.0.1 -
DisableRemoveExpiredconfiguration added; IfTRUEthe cache instance won`t delete expired items. - v3.0
- [BREAKING CHANGE] - Direct instantiation not preferred
- Single thread loop remover
- v2.0.x - Update everything to net5.0, more detailed sample project.
- v1.0.8 - Update to latest dependencies -
License
- MIT
This is a fork from repo
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Dapper (>= 2.0.123)
- Microsoft.Extensions.Caching.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
- Npgsql (>= 7.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Community.Microsoft.Extensions.Caching.PostgreSql:
| Package | Downloads |
|---|---|
|
Pipoburgos.SharedKernel.Infrastructure.EntityFrameworkCore.PostgreSQL
EntityFrameworkCore.PostgreSQL infrastructure implementations |
|
|
SoftwaredeveloperDotAt.Infrastructure.Core.PostgreSQL
Library for base .NET Classes |
|
|
SuperiorAcumaticaPackage
Dependencies required to compile the SuperiorAcumaticaSolution for Acumatica 2025 R2 Build 25.200.0248 |
|
|
IdentitySuite.EntityFrameworkCore.PostgreSql
PostgreSql store for IdentitySuite, a ready-to-use OpenId Connect Server based on Openiddict with Microsoft Identity and a comprehensive management shell. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Community.Microsoft.Extensions.Caching.PostgreSql:
| Repository | Stars |
|---|---|
|
simpleidserver/SimpleIdServer
OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.1.0-next | 592 | 7/10/2025 |
| 5.0.1 | 39,042 | 7/9/2025 |
| 5.0.0 | 131,440 | 12/30/2024 |
| 4.0.6 | 179,531 | 8/20/2024 |
| 4.0.4 | 189,656 | 10/2/2023 |
| 4.0.2 | 75,371 | 12/27/2022 |
| 4.0.1 | 4,308 | 12/6/2022 |
| 3.1.2 | 100,440 | 5/25/2022 |
| 3.1.1 | 26,369 | 2/22/2022 |
| 3.1.0 | 11,702 | 12/20/2021 |
| 3.0.3.2 | 50,116 | 5/14/2021 |
| 3.0.2 | 1,392 | 4/4/2021 |
| 3.0.1 | 26,595 | 1/17/2021 |
| 3.0.0 | 996 | 1/9/2021 |
| 2.0.7 | 2,774 | 11/27/2020 |
| 1.0.30 | 83,112 | 4/20/2019 |
| 1.0.7 | 4,039 | 3/24/2018 |
| 1.0.5 | 1,177 | 3/22/2018 |
| 1.0.0 | 1,617 | 3/22/2018 |