https://github.com/replaysmike/anycache
AnyCache is a modified clone of LazyCache for caching any .Net type in a thread-safe manner
https://github.com/replaysmike/anycache
asp-net asp-net-core c-sharp cache caching inmemory lazy lazycache performance redis
Last synced: 2 months ago
JSON representation
AnyCache is a modified clone of LazyCache for caching any .Net type in a thread-safe manner
- Host: GitHub
- URL: https://github.com/replaysmike/anycache
- Owner: replaysMike
- License: mit
- Created: 2020-03-31T01:22:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T02:48:26.000Z (about 6 years ago)
- Last Synced: 2025-03-10T15:19:49.299Z (over 1 year ago)
- Topics: asp-net, asp-net-core, c-sharp, cache, caching, inmemory, lazy, lazycache, performance, redis
- Language: C#
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AnyCache
[](https://www.nuget.org/packages/AnyCache/)
[](https://www.nuget.org/packages/AnyCache/)
[](https://ci.appveyor.com/project/MichaelBrown/AnyCache)
AnyCache is a modified clone of [LazyCache](https://github.com/alastairtree/LazyCache) for caching any .Net type, with multiple storage providers available. It provides an in-memory cache that leverages Microsoft.Extensions.Caching and provides performance and reliability in heavy load scenarios.
## Installation
```Powershell
PM> Install-Package AnyCache
```
## Getting Started
```csharp
// This follows the exact same interface as LazyCache. Create or inject (DI) your caching service
IAppCache cache = new CachingService();
// Get our existing item in the cache by referencing its key, and provide the factory to create a new object if it's not in the cache
var myObjectInstance = cache.GetOrAdd("uniqueKey", () => methodThatTakesTimeOrResources());
```
## Features
* Super simple usage with sliding or absolute expiration
* Thread safe, concurrency ready
* Async compatible (where LazyCache had some issues)
* Supports dependency injection
* Strongly typed generics and object based support
## Providers
* [Redis distributed storage](https://github.com/replaysMike/AnyCache.Providers.Redis)