项目作者: gegaryfa

项目描述 :
.Net Core API - Repository pattern with auto refresh cache
高级语言: C#
项目地址: git://github.com/gegaryfa/RepositoryPatternWithAutoRefreshCache.git
创建时间: 2020-10-24T10:42:22Z
项目社区:https://github.com/gegaryfa/RepositoryPatternWithAutoRefreshCache

开源协议:MIT License

下载


Repository Pattern With Auto-Refresh Cache

license
GitHub stars

.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).

Getting Started

Clone the repo, open a terminal and run make to see all the possible actions.
makefile

The project setup is based on Domain Driven Design:
makefile

Prerequisites

Installing

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:

  1. 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:

  • The web API @: http://localhost:8000/
  • A SQL server with some dummy data already seeded in a database.
  • A redis cache which is being used when you set redis as the cache provider.

Alternatively, you can run the RepositoryWithCaching.WebApi project which will use In-memory(by default) data instead of a database on a sql server.

Built With

Sources

A good read on distributed caching for .Net Core: Distributed caching in ASP.NET Core.

Authors

  • George Garyfallou - Initial work - gegaryfa

Acknowledgments

  • Hat tip to anyone whose code was used