{"id":13414856,"url":"https://github.com/dotnetcore/EasyCaching","last_synced_at":"2025-03-14T22:32:15.160Z","repository":{"id":37692960,"uuid":"110331593","full_name":"dotnetcore/EasyCaching","owner":"dotnetcore","description":":boom: 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!","archived":false,"fork":false,"pushed_at":"2024-12-25T06:00:20.000Z","size":3597,"stargazers_count":1982,"open_issues_count":44,"forks_count":327,"subscribers_count":76,"default_branch":"dev","last_synced_at":"2024-12-30T21:15:50.575Z","etag":null,"topics":["aspnetcore","cache","caching","distributed-cache","hybrid-cache","interceptor","memcached","memory-cache","redis","sqlite"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotnetcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-11T08:53:56.000Z","updated_at":"2024-12-26T13:54:33.000Z","dependencies_parsed_at":"2022-08-08T21:16:09.344Z","dependency_job_id":"cf4c3573-8f8f-479a-a0a9-3664e3ee9827","html_url":"https://github.com/dotnetcore/EasyCaching","commit_stats":{"total_commits":743,"total_committers":57,"mean_commits":"13.035087719298245","dds":0.2207267833109018,"last_synced_commit":"04b17e8a63937c7765dba82d4a46db7537135cab"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FEasyCaching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FEasyCaching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FEasyCaching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnetcore%2FEasyCaching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnetcore","download_url":"https://codeload.github.com/dotnetcore/EasyCaching/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324310,"owners_count":20273104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","cache","caching","distributed-cache","hybrid-cache","interceptor","memcached","memory-cache","redis","sqlite"],"created_at":"2024-07-30T21:00:38.392Z","updated_at":"2025-03-14T22:32:15.153Z","avatar_url":"https://github.com/dotnetcore.png","language":"C#","readme":"![](media/easycaching-icon.png?raw=true)\n\nEasyCaching is an open-source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easily!\n\n[![Coverage Status](https://coveralls.io/repos/github/catcherwong/EasyCaching/badge.svg?branch=master)](https://coveralls.io/github/catcherwong/EasyCaching?branch=master)\n[![Member project of .NET Core Community](https://img.shields.io/badge/member%20project%20of-NCC-9e20c9.svg)](https://github.com/dotnetcore)\n[![GitHub license](https://img.shields.io/github/license/dotnetcore/EasyCaching.svg)](https://github.com/dotnetcore/EasyCaching/blob/master/LICENSE)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdotnetcore%2FEasyCaching.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdotnetcore%2FEasyCaching?ref=badge_shield)\n\n## CI Build Status\n\n| Platform | Build Server | Master Status  | Dev Status  |\n|--------- |------------- |---------|---------|\n| Github Action   | Linux/Windows | [![Build\u0026Test](https://github.com/dotnetcore/EasyCaching/actions/workflows/buildandtest.yml/badge.svg)](https://github.com/dotnetcore/EasyCaching/actions/workflows/buildandtest.yml) |    [![Build\u0026Test](https://github.com/dotnetcore/EasyCaching/actions/workflows/buildandtest.yml/badge.svg)](https://github.com/dotnetcore/EasyCaching/actions/workflows/buildandtest.yml) |\n\n## Nuget Packages\n\n| Package Name                                                                                                          | Version                                                                          | Downloads\n|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| ---------------------------------------------------------------------------------\n| [EasyCaching.Core](https://www.nuget.org/packages/EasyCaching.Core)                                                   | ![](https://img.shields.io/nuget/v/EasyCaching.Core.svg)                         | ![](https://img.shields.io/nuget/dt/EasyCaching.Core.svg)\n| [EasyCaching.InMemory](https://www.nuget.org/packages/EasyCaching.InMemory)                                           | ![](https://img.shields.io/nuget/v/EasyCaching.InMemory.svg)                     | ![](https://img.shields.io/nuget/dt/EasyCaching.InMemory.svg)\n| [EasyCaching.Redis](https://www.nuget.org/packages/EasyCaching.Redis)                                                 | ![](https://img.shields.io/nuget/v/EasyCaching.Redis.svg)                        | ![](https://img.shields.io/nuget/dt/EasyCaching.Redis.svg)\n| [EasyCaching.Memcached](https://www.nuget.org/packages/EasyCaching.Memcached)                                         | ![](https://img.shields.io/nuget/v/EasyCaching.Memcached.svg)                    | ![](https://img.shields.io/nuget/dt/EasyCaching.Memcached.svg)\n| [EasyCaching.SQLite](https://www.nuget.org/packages/EasyCaching.SQLite)                                               | ![](https://img.shields.io/nuget/v/EasyCaching.SQLite.svg)                       | ![](https://img.shields.io/nuget/dt/EasyCaching.SQLite.svg)\n| [EasyCaching.HybridCache](https://www.nuget.org/packages/EasyCaching.HybridCache)                                     | ![](https://img.shields.io/nuget/v/EasyCaching.HybridCache.svg)                  | ![](https://img.shields.io/nuget/dt/EasyCaching.HybridCache.svg)\n| [EasyCaching.CSRedis](https://www.nuget.org/packages/EasyCaching.CSRedis)                                             | ![](https://img.shields.io/nuget/v/EasyCaching.CSRedis.svg)                      | ![](https://img.shields.io/nuget/dt/EasyCaching.CSRedis.svg)\n| [EasyCaching.FreeRedis](https://www.nuget.org/packages/EasyCaching.FreeRedis)                                         | ![](https://img.shields.io/nuget/v/EasyCaching.FreeRedis.svg)                    | ![](https://img.shields.io/nuget/dt/EasyCaching.FreeRedis.svg)\n| [EasyCaching.FasterKv](https://www.nuget.org/packages/EasyCaching.FasterKv)                                           | ![](https://img.shields.io/nuget/v/EasyCaching.FasterKv.svg)                     | ![](https://img.shields.io/nuget/dt/EasyCaching.FasterKv.svg)\n| [EasyCaching.Disk](https://www.nuget.org/packages/EasyCaching.Disk)                                                   | ![](https://img.shields.io/nuget/v/EasyCaching.Disk.svg)                         | ![](https://img.shields.io/nuget/dt/EasyCaching.Disk.svg)\n| [EasyCaching.LiteDB](https://www.nuget.org/packages/EasyCaching.LiteDB)                                               | ![](https://img.shields.io/nuget/v/EasyCaching.LiteDB.svg)                       | ![](https://img.shields.io/nuget/dt/EasyCaching.LiteDB.svg)\n| [EasyCaching.Interceptor.Castle](https://www.nuget.org/packages/EasyCaching.Interceptor.Castle)                       | ![](https://img.shields.io/nuget/v/EasyCaching.Interceptor.Castle.svg)           | ![](https://img.shields.io/nuget/dt/EasyCaching.Interceptor.Castle.svg)\n| [EasyCaching.Interceptor.AspectCore](https://www.nuget.org/packages/EasyCaching.Interceptor.AspectCore)               | ![](https://img.shields.io/nuget/v/EasyCaching.Interceptor.AspectCore.svg)       | ![](https://img.shields.io/nuget/dt/EasyCaching.Interceptor.AspectCore.svg)\n| [EasyCaching.Serialization.MessagePack](https://www.nuget.org/packages/EasyCaching.Serialization.MessagePack)         | ![](https://img.shields.io/nuget/v/EasyCaching.Serialization.MessagePack.svg)    | ![](https://img.shields.io/nuget/dt/EasyCaching.Serialization.MessagePack.svg)\n| [EasyCaching.Serialization.Json](https://www.nuget.org/packages/EasyCaching.Serialization.Json)                       | ![](https://img.shields.io/nuget/v/EasyCaching.Serialization.Json.svg)           | ![](https://img.shields.io/nuget/dt/EasyCaching.Serialization.Json.svg)\n| [EasyCaching.Serialization.SystemTextJson](https://www.nuget.org/packages/EasyCaching.Serialization.SystemTextJson)   | ![](https://img.shields.io/nuget/v/EasyCaching.Serialization.SystemTextJson.svg) | ![](https://img.shields.io/nuget/dt/EasyCaching.Serialization.SystemTextJson.svg)\n| [EasyCaching.Serialization.Protobuf](https://www.nuget.org/packages/EasyCaching.Serialization.Protobuf)               | ![](https://img.shields.io/nuget/v/EasyCaching.Serialization.Protobuf.svg)       | ![](https://img.shields.io/nuget/dt/EasyCaching.Serialization.Protobuf.svg)\n| [EasyCaching.Serialization.MemoryPack](https://www.nuget.org/packages/EasyCaching.Serialization.MessagePack)          | ![](https://img.shields.io/nuget/v/EasyCaching.Serialization.MemoryPack.svg)     | ![](https://img.shields.io/nuget/dt/EasyCaching.Serialization.MemoryPack.svg)\n| [EasyCaching.Bus.RabbitMQ](https://www.nuget.org/packages/EasyCaching.Bus.RabbitMQ)                                   | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.RabbitMQ.svg)                 | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.RabbitMQ.svg)\n| [EasyCaching.Bus.RabbitMQStream](https://www.nuget.org/packages/EasyCaching.Bus.RabbitMQStream)                       | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.RabbitMQStream.svg)           | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.RabbitMQStream.svg)\n| [EasyCaching.Bus.Redis](https://www.nuget.org/packages/EasyCaching.Bus.Redis)                                         | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.Redis.svg)                    | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.Redis.svg)\n| [EasyCaching.Bus.CSRedis](https://www.nuget.org/packages/EasyCaching.Bus.CSRedis)                                     | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.CSRedis.svg)                  | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.CSRedis.svg)\n| [EasyCaching.Bus.ConfluentKafka](https://www.nuget.org/packages/EasyCaching.Bus.ConfluentKafka)                       | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.ConfluentKafka.svg)           | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.ConfluentKafka.svg)\n| [EasyCaching.Bus.Zookeeper](https://www.nuget.org/packages/EasyCaching.Bus.Zookeeper)                                 | ![](https://img.shields.io/nuget/v/EasyCaching.Bus.Zookeeper.svg)                | ![](https://img.shields.io/nuget/dt/EasyCaching.Bus.Zookeeper.svg)\n| [EasyCaching.ResponseCaching](https://www.nuget.org/packages/EasyCaching.ResponseCaching)                             | ![](https://img.shields.io/nuget/v/EasyCaching.ResponseCaching.svg)              | ![](https://img.shields.io/nuget/dt/EasyCaching.ResponseCaching.svg)\n\n## Basic Usages\n\n### Step 1 : Install the package\n\nChoose caching provider that you need and install it via Nuget.\n\n```\nInstall-Package EasyCaching.InMemory\nInstall-Package EasyCaching.Redis\nInstall-Package EasyCaching.SQLite\nInstall-Package EasyCaching.Memcached\nInstall-Package EasyCaching.FasterKv\n```\n\n### Step 2 : Configure Startup class\n\nEach caching provider has it's own configuration options.\n\nHere is a sample configuration for InMemory and Redis caching provider.\n\n```csharp\npublic class Startup\n{\n    //...\n    \n    public void ConfigureServices(IServiceCollection services)\n    {\n        //configuration\n        services.AddEasyCaching(options =\u003e \n        {\n            //use memory cache that named default\n            options.UseInMemory(\"default\");\n\n            // // use memory cache with your own configuration\n            // options.UseInMemory(config =\u003e \n            // {\n            //     config.DBConfig = new InMemoryCachingOptions\n            //     {\n            //         // scan time, default value is 60s\n            //         ExpirationScanFrequency = 60, \n            //         // total count of cache items, default value is 10000\n            //         SizeLimit = 100 \n            //     };\n            //     // the max random second will be added to cache's expiration, default value is 120\n            //     config.MaxRdSecond = 120;\n            //     // whether enable logging, default is false\n            //     config.EnableLogging = false;\n            //     // mutex key's alive time(ms), default is 5000\n            //     config.LockMs = 5000;\n            //     // when mutex key alive, it will sleep some time, default is 300\n            //     config.SleepMs = 300;\n            // }, \"m2\");\n\n            //use redis cache that named redis1\n            options.UseRedis(config =\u003e \n            {\n                config.DBConfig.Endpoints.Add(new ServerEndPoint(\"127.0.0.1\", 6379));\n            }, \"redis1\")\n            .WithMessagePack()//with messagepack serialization\n            ;            \n        });    \n    }    \n}\n```\n\n### Step 3 : Write code in your controller\n\n```csharp\n[Route(\"api/[controller]\")]\npublic class ValuesController : Controller\n{\n    // //when using single provider\n    // private readonly IEasyCachingProvider _provider;\n    //when using multiple provider\n    private readonly IEasyCachingProviderFactory _factory;\n\n    public ValuesController(\n        //IEasyCachingProvider provider, \n        IEasyCachingProviderFactory factory\n        )\n    {\n        //this._provider = provider;\n        this._factory = factory;\n    }\n\n    [HttpGet]\n    public string Handle()\n    {\n        //var provider = _provider;\n        //get the provider from factory with its name\n        var provider = _factory.GetCachingProvider(\"redis1\");    \n\n        //Set\n        provider.Set(\"demo\", \"123\", TimeSpan.FromMinutes(1));\n            \n        //Set Async\n        await provider.SetAsync(\"demo\", \"123\", TimeSpan.FromMinutes(1));                  \n    }\n}\n```\n\n## Documentation\n\nDetailed EasyCaching documentation can be found [here](http://easycaching.readthedocs.io/en/latest/).\n\n## Extension Libs\n\n| Package Name                                                                                                                                          | Downloads                                                                         | Description\n|-------------------------------------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------------\n| [EasyCaching.Extensions.EasyCompressor](https://github.com/mjebrahimi/EasyCompressor/blob/master/src/EasyCaching.Extensions.EasyCompressor/README.md) | ![](https://img.shields.io/nuget/dt/EasyCaching.Extensions.EasyCompressor.svg)    | Compress your cache objects to speedup transferring data over network, reduce bandwidth usage, and memory usage of cache server\n| [EasyCaching.Extensions](https://github.com/yrinleung/EasyCaching.Extensions)                                                                         |                                                                                   | EasyCaching integration for CAP, WebApiClient, IDistributedCache, ...\n\n## Examples\n\nSee [sample](https://github.com/catcherwong/EasyCaching/tree/master/sample)\n\n## Todo List\n\nSee [ToDo List](docs/ToDoList.md)\n\n## Contributing\n\nPull requests, issues and commentary!\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdotnetcore%2FEasyCaching.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdotnetcore%2FEasyCaching?ref=badge_large)\n","funding_links":[],"categories":["Caching","缓存","Frameworks, Libraries and Tools","others","框架, 库和工具","Libraries, Frameworks and Tools","C\\#","C# #"],"sub_categories":["Caching","缓存"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcore%2FEasyCaching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnetcore%2FEasyCaching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnetcore%2FEasyCaching/lists"}