.Net Core API - Repository pattern with auto refresh cache
.Net Core API - Repository pattern with auto refresh cache. This is a simple API using the repository design pattern to get data from a database. The data from the database are being cached either InMemory or in Redis(for scaled systems).
Clone the repo, open a terminal and run make
to see all the possible actions.
The project setup is based on Domain Driven Design:
GNU Make
.Net Core v5.0
Docker
I created a makefile to make it as easy as possible to get the docker containers up and runnig 😎. The only thing you need to do is run:
make up
After that you need to wait for the project to build and you are all set!
The make command will run the docker-compose file and download all the images required for the porject. This will take some time so be patient ☕.
When the make up
command is finished, you should have 3 containers running:
Alternatively, you can run the RepositoryWithCaching.WebApi
project which will use In-memory(by default) data instead of a database on a sql server.
A good read on distributed caching for .Net Core: Distributed caching in ASP.NET Core.