Code Monkey home page Code Monkey logo

distributedcacheaspnetcoreredis's Introduction

Distributed Caching on .NET with IDistributedCache

.NET CodeQL Twitter: _SahanSera

Intro 👋

This project leverages the IDistributedCache that's shipped as part of .NET/.NET Core SDKs to achieve distributed caching in a microservices environment. If you are looking for a monolithing caching approach, then, my other project would be more suitable for you.

I've also blogged this with a full explanation of how this is achieved.

Note: I have recently migrated this project to .NET 6 and also a docker-compose.yaml for better dev experience 🎉 You can still access the old version from the .NET 5 branch in this repo.

Architecture 🏗

  1. User requests a user object.
  2. App server checks if we already have a user in the cache and return the object if present.
  3. App server makes a HTTP call to retrieve the list of users.
  4. Users service returns the users list to the app server.
  5. App server sends the users list to the distributed (Redis) cache.
  6. App server gets the cached version until it expires (TTL).
  7. User gets the cached user object.

Usage 🚀

Open up a terminal and run the following:

docker-compose up and dotnet run

Questions? Bugs? Suggestions for Improvement? ❓

Having any issues or troubles getting started? Get in touch with me

Support 🎗

Has this Project helped you learn something new? or helped you at work? Please consider giving a ⭐️ if this project helped you!

Share it! ❤️

Please share this Repository within your developer community, if you think that this would make a difference! Cheers.

Contributing ✍️

PRs are welcome! Thank you

distributedcacheaspnetcoreredis's People

Contributors

sahansera avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.