Skip to content

brunoldias/RedisCache.Contrib

Repository files navigation

RedisCache.Contrib RedisCache

Library to use simple distributed caching.

How to use

  • You need install docker in your machine to build in local, you can use in production just alter a configuration Instace in startup project.
docker run -d -p 6379:6379 -i -t redis:3.2.5-alpine
  • Install RedisCache.Contrib: RedisCache on your application.
  • Insert in your startup the code below:
 builder.Services.AddRedisCache(opt => { opt.InstanceName = "redis-cache"; opt.Configuration = "localhost:6379"; });

image

  • After installing you can use the interface ICacheManager in your application. you can see below:

image

  • In this interface there are two methods

  • ExecuteCacheAsync - creates and retrieves information from the cache, you need to pass three parameters to class.

image

Params :

  • key - parameter to pass the name of the key value that will be stored
  • value - a lambda expression where the data you want to cache will run.
  • TimeExpiration - parameter used to expire the stored cache, it is an ENUM, which is composed as follows:

image

  • Another parameter is Get() - brings the key stored in the bank and its value.

Params:

  • key - pass a key armazened and you have returned your value.

this project is growing, new features will be started, you can contribute.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages