Skip to content
A PostgreSQL Implementation of IDistributedCache interface. Using Postgresql as distributed cache in Asp.Net Core. NetStandard 2.0
C# PLpgSQL Batchfile
Branch: master
Clone or download
Pull request Compare This branch is even with leonibr:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



This implemantation uses PostgreSQL as distributed cache.

Getting Started

  1. Install the package into your project
dotnet add package Community.Microsoft.Extensions.Caching.PostgreSql
  1. Add the following line to the Startup Configure method.
services.AddDistributedPostgreSqlCache(setup => 
	ConnectionString = configuration["ConnectionString"], 
	SchemaName = configuration["SchemaName"],
	TableName = configuration["TableName"],
	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.

What it does to my database:

Creates a table and six functions, see scripts folder for more details.


Runing the sample

You will need a local postgresql server with this configuration:

  1. Server listening to port 5432 at localhost
  2. The password of your postgres account, if not attached already to your user.
  3. Clone this repo.
  4. Run the following commands inside PostgreSqlCacheSample:
dotnet restore
prepare-database.cmd -create
dotnet run

Then you can delete the database with:

prepare-database.cmd -erase

Change Log

  1. v1.0.8 - Update to latest dependencies -


  • MIT

This is a fork from repo

You can’t perform that action at this time.