All Projects → Hesapkurdu → hk-cache-manager

Hesapkurdu / hk-cache-manager

Licence: other
Simple wrapper for Redis Cache with Stackoverflow.Redis & AspNetCore aim

Programming Languages

C#
18002 projects
powershell
5483 projects
shell
77523 projects

Projects that are alternatives of or similar to hk-cache-manager

Easycaching
💥 EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
Stars: ✭ 1,047 (+6058.82%)
Mutual labels:  aspnetcore, cache
AspSqliteCache
An ASP.NET Core IDistributedCache provider backed by SQLite
Stars: ✭ 39 (+129.41%)
Mutual labels:  aspnetcore, cache
MR.AspNetCore.Jobs
A background processing library for Asp.Net Core.
Stars: ✭ 59 (+247.06%)
Mutual labels:  aspnetcore
BlazorServerWithDocker
Companion code sample for my blog post - Containerising a Blazor Server App
Stars: ✭ 16 (-5.88%)
Mutual labels:  aspnetcore
DevOpsExamples
A repo to show you how to use a private NuGet feed, such as Telerik, to restore packages in Azure DevOps, GitHub Actions, GitLab CI and AppCenter.
Stars: ✭ 16 (-5.88%)
Mutual labels:  aspnetcore
bazel-cache
Minimal cloud oriented Bazel gRPC cache
Stars: ✭ 33 (+94.12%)
Mutual labels:  cache
AspNetCore.Mvc.FluentActions
Fluent Actions for ASP.NET Core MVC are abstractions of regular MVC actions that are converted into MVC actions during startup.
Stars: ✭ 17 (+0%)
Mutual labels:  aspnetcore
memoize
Caching library for asynchronous Python applications.
Stars: ✭ 53 (+211.76%)
Mutual labels:  cache
bash-cache
Transparent caching layer for bash functions; particularly useful for functions invoked as part of your prompt.
Stars: ✭ 45 (+164.71%)
Mutual labels:  cache
JqueryDataTablesServerSideDemo
Jquery DataTables with Asp.Net Core server side multi column sorting and searching Demo Project.
Stars: ✭ 43 (+152.94%)
Mutual labels:  aspnetcore
infinitree
Scalable and encrypted embedded database with 3-tier caching
Stars: ✭ 80 (+370.59%)
Mutual labels:  cache
moment-cache
⏱ Simple utility to cache moment.js results and speed up moment calls.
Stars: ✭ 29 (+70.59%)
Mutual labels:  cache
tacky
Primitive Object Memoization for Ruby
Stars: ✭ 14 (-17.65%)
Mutual labels:  cache
ultrafetch
Node-based fetch backed with an RFC-7234 compliant filesystem cache.
Stars: ✭ 30 (+76.47%)
Mutual labels:  cache
tiny-cache
Cache WordPress post content, template part, translations and nav menu output in persistent object cache
Stars: ✭ 26 (+52.94%)
Mutual labels:  cache
CacheLib
Pluggable in-process caching engine to build and scale high performance services
Stars: ✭ 637 (+3647.06%)
Mutual labels:  cache
AspNetCoreAzureSearch
ASP.NET Core with Azure Cognitive Search
Stars: ✭ 12 (-29.41%)
Mutual labels:  aspnetcore
varnish-cache-reaper
Simple python/twisted HTTP daemon forwarding PURGE and BAN requests to multiple varnish (or other proxy) instances
Stars: ✭ 12 (-29.41%)
Mutual labels:  cache
fastapi-cache
fastapi-cache is a tool to cache fastapi response and function result, with backends support redis and memcached.
Stars: ✭ 375 (+2105.88%)
Mutual labels:  cache
regex-cache
Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in dramatic speed improvements.
Stars: ✭ 39 (+129.41%)
Mutual labels:  cache

Build status Quality Gate Status

Hesapkurdu.com Cache Manager

Easy usage & cleaner code with cache related code.

This project aims developers who use Redis as Cache Server. Provides easy API response cache, Entity/complex object cache, simple cache structure for developers.

It is simply a wrapper for Stackexchange.Redis and AspNetCore Service & ActionFilter.

Overview

This package can help caching responses and complex object cleaner! Here is simple example:

    [HttpGet]
    [RedisResponseCache]
    public ActionResult<IEnumerable<string>> Get()
    {
        return new[] { "value1", "value2" };
    }

This example shows how easily response cache with Redis.

You can easily use this feature. Just need add to AspNetCore Services.

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        //Order not important
        services.AddMvc();

        services.AddHkRedisCache(new HkRedisOptions
        {
            ConnectionString = "localhost:6379",
            DatabaseId = 1,
            Timeout = TimeSpan.FromHours(1) //(default value of cache timeout)
        });
    }
}

Also it provides complex object caching.

    [HttpGet("{id}")]
    public async Task<IActionResult> Get([FromRoute] int id)
    {
        var data = _cacheManager.Get<Customer>($"{nameof(Customer)}:{id}");
        if(data == null)
          return Ok(_context.Customers.FirstOrDefault(x => x.Id == id));
        else
        return Ok(data);
    }

Instead of this code you can use easily example down below.

    [HttpGet("{id}")]
    public async Task<IActionResult> Get([FromRoute] int id)
    {
        var result = _cacheManager.GetFromCacheOrRun($"{nameof(Customer)}:{id}", () => { return _context.Customers.FirstOrDefault(x => x.Id == id); });
        return Ok(result);
    }

This simple usage cache any function response. It is useful for DAL return caching. You can use for every function! (Except void)

Also provides simple caching with Cache Manager object (ICacheManager)

public class CustomerController : ControllerBase
    {
        private readonly ICacheManager _cacheManager;
        private readonly ApplicationDbContext _context;

        public CustomerController(ICacheManager cacheManager, ApplicationDbContext context)
        {
            _cacheManager = cacheManager;
            _context = context;
        }

        [HttpGet("cache/{id}")]
        public async Task<IActionResult> GetFromCache([FromRoute]int id)
        {
            var result = _context.Customers.FirstOrDefault(x => x.Id == id);
            _cacheManager.SetCache(result);
            return Ok(result);
        }

Also have some overload for simple usage

_cacheManager.SetCache(customerObject);
_cacheManager.SetCache("RedisKey",customerObject);
_cacheManager.SetCache("RedisKey",stringObject);

Cache Keys for objects

public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
}

var customer = new Customer(){Id = 1, Name="Orhun"}
_cacheManager.SetCache(customerObject);
//key will be "Customer:1_Orhun"

Cache Keys will be every value with "_" (underscore) seperated. ":" (colon) for Redis default foldering mark.

Build

Install Visual Studio 2017 & .Net Core 2.1+ and run!

build.ps1

Who uses this package?

Hesapkurdu.com R&D team using at production!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].