Skip to content

Commit

Permalink
docs: README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairtree committed Mar 4, 2018
1 parent b0b970e commit 6917aca
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Lazy cache is a simple in-memory caching service. It has a developer friendly
generics based API, and provides a thread safe cache implementation that
guarantees to only execute your cachable delegates once (it's lazy!). Under
the hood it leverages ObjectCache and Lazy<T> to provide performance and
the hood it leverages Microsoft.Extensions.Caching and Lazy<T> to provide performance and
reliability in heavy load scenarios.

## Download ##
Expand All @@ -21,7 +21,7 @@ PM> Install-Package LazyCache

```csharp
// Create our cache service using the defaults (Dependency injection ready).
// Uses MemoryCache.Default under the hood so cache is shared out of the box
// By default it uses a single shared cache under the hood so cache is shared out of the box (but you can configure this)
IAppCache cache = new CachingService();

// Declare (but don't execute) a func/delegate whose result we want to cache
Expand All @@ -36,9 +36,21 @@ As you can see the magic happens in the `GetOrAdd()` method which gives the cons

It means you avoid the usual "Check the cache - execute the factory function - add results to the cache" pattern, saves you writing the double locking cache pattern and means you can be a lazy developer!

## Use case ##
## What should I use it for?

LazyCache suits the caching of database calls, complex object graph building routines and web service calls that should be cached for performance.
Allows items to be cached for long or short periods, but defaults to 20 mins.

## .Net framework and dotnet core support?

The latest version targets netstandard 2.0. See [.net standard implementation support](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support)

For dotnet core 2, .net framwork net461 or above, netstandard 2+, use LazyCache 2 or above.

For .net framework without netstandard 2 support such as net45 net451 net46 use LazyCache 0.7 - 1.x

For .net framework 4.0 use LazyCache 0.6

Suits the caching of database calls, complex object graph building routines and web service calls that should be cached for performance. Allows items to be cached for long or short periods, but defaults to 20 mins.

## Features ##

Expand All @@ -48,10 +60,8 @@ Suits the caching of database calls, complex object graph building routines and
- Thread safe, concurrency ready
- Async compatible - lazy single evaluation of async delegates using `GetOrAddAsync()`
- Interface based API and built in `MockCache` to support test driven development and dependency injection
- Leverages ObjectCache under the hood and can be extended with your own implementation of ObjectCache
- The main class `CachingSevice` is a single class and so could be easily embedded in your application or library
- Leverages a provider model on top of IMemoryCache under the hood and can be extended with your own implementation
- Good test coverage
- net45 upwards. (for .net4 use Lazycache 0.6)

## Documentation

Expand All @@ -60,6 +70,6 @@ Suits the caching of database calls, complex object graph building routines and

## Sample Application

See `/Samples/ApiAsyncCachingSample` for an example of how to use LazyCache to cache the results of an Entity framework async query in
See [/Samples/CacheDatabaseQueriesApiSample](https://github.com/alastairtree/LazyCache/tree/master/CacheDatabaseQueriesApiSample) for an example of how to use LazyCache to cache the results of an Entity framework query in
a web api controller. Watch how the cache saves trips to the database and results are returned to the client far quicker from the
in-memory cache

0 comments on commit 6917aca

Please sign in to comment.