Giter VIP home page Giter VIP logo

developmentfast.cacheredis's Introduction

DevelopmentFast.Cache

Uma biblioteca para ajudar no rápido desenvolvimento para aplicar camada de Cache utilizando Redis, usando Repository Pattern.

Logo

Development Fast - Cache

Package Version Popularity
DevelopmentFast.Cache NuGet Nuget

What is it ?

📌 It is a .NET library with the responsibility to help in the fast development to apply Cache layer using Redis, using Repository Pattern.

Why i created ?

📌 To make development easier and save the time I had to configure a cache layer to apply anywhere in the project.

Where is it available ?

📌 It is available on .Nuget.org
Nuget Link

Install-Package DevelopmentFast.CacheRedis -Version 1.0.1

How to use ?

Dependency and connection injections

builder.Services.AddSingleton<IDistributedCache, RedisCache>();
builder.Services.AddStackExchangeRedisCache(x => x.Configuration = "localhost:6379");

Or

//Scoped
  services.AddScopedRedisCacheDF(x =>
  {
      x.Configuration = "localhost:6379";
  });

//Transient
  services.AddTransientRedisCacheDF(x =>
  {
      x.Configuration = "localhost:6379";
  });

//Singleton
  services.AddSingletonRedisCacheDF(x =>
  {
      x.Configuration = "localhost:6379";
  });

Constructor

private readonly IBaseRedisRepositoryDF _baseRedisRepositoryDF;

public StudentController(IBaseRedisRepositoryDF baseRedisRepositoryDF)
{
    this._baseRedisRepositoryDF = baseRedisRepositoryDF;
}

Create or Update asynchronous

var student = new Student("name_student");
await _baseRedisRepositoryDF.CreateOrUpdateAsync<Student>("key_example", student , TimeSpan.FromMinutes(1));

Create or Update synchronous

var student = new Student("name_student");
_baseRedisRepositoryDF.CreateOrUpdate<Student>("key_example", student , TimeSpan.FromMinutes(1));

Get asynchronous

var student = await _baseRedisRepositoryDF.GetAsync<Student>("key_example");

Get synchronous

var student =  _baseRedisRepositoryDF.Get<Student>("key_example");

Remove synchronous

_baseRedisRepositoryDF.Remove("key_example");

Remove asynchronous

_baseRedisRepositoryDF.RemoveAsync("key_example");

Refresh synchronous

_baseRedisRepositoryDF.Refresh("key_example");

Refresh asynchronous

_baseRedisRepositoryDF.RefreshAsync("key_example");

developmentfast.cacheredis's People

Contributors

abnermatheus avatar

Stargazers

 avatar

Watchers

 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.