Skip to content

TheGresta/CacheWithRedis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

CacheWithRedis

⏬ ICachableRequest ⏬

  • BypassCache => If this value is true, program will ignore this cache and will run the command.
  • CacheKey => The string value to map the result. With this key, we can access the result whenever we want.
  • SlidingExpiration => Time cost for the cache. After the given time pass, Redis will delete this result from memory.

⏬ ICacheRemoverRequest ⏬

  • BypassCache => If this value is true, program will ignore this cache and will run the command.
  • CacheKey => The string value to access the keys. With this key, remove the caches we want from the Redis memory. Whichever key has this value in the name, will be deleted from the memory.

⏬ Examples ⏬

1️⃣ GetByIdCityQuery

    public bool BypassCache => false;

    public string CacheKey => $"{this.GetType().Name}&id={this.Id}";

    public TimeSpan? SlidingExpiration => TimeSpan.FromMinutes(10);

2️⃣ GetListCityQuery

    public bool BypassCache => false;

    public string CacheKey => $"{this.GetType().Name}&pagesize={this.PageRequest.Page}&page={this.PageRequest.PageSize}";

    public TimeSpan? SlidingExpiration => TimeSpan.FromMinutes(20);

3️⃣ DeleteCityCommand

    public bool BypassCache => true;

    public string CacheKey => "City";

⏬ Screenshots ⏬

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages