Skip to content

Commit 964e635

Browse files
author
Alex Peck
committed
readme
1 parent e26a32b commit 964e635

File tree

2 files changed

+59
-14
lines changed

2 files changed

+59
-14
lines changed

src/BitFaster.Caching.DependencyInjection/BitFaster.Caching.DependencyInjection.csproj

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<Copyright>Copyright © Alex Peck $([System.DateTime]::Now.ToString(yyyy))</Copyright>
66
<RepositoryUrl>https://github.com/bitfaster/BitFaster.Caching.DependencyInjection</RepositoryUrl>
7-
<PackageProjectUrl></PackageProjectUrl>
8-
<Authors>Alex Peck</Authors>
9-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
10-
<Company />
11-
<Product>BitFaster.Caching</Product>
12-
<Description>High performance, thread-safe in-memory caching primitives for .NET.</Description>
13-
<PackageTags>Cache;LRU;LFU;Performance;In-Memory;Thread-Safe;Concurrent</PackageTags>
14-
<PackageId>BitFaster.Caching.DependencyInjection</PackageId>
15-
<AssemblyName>BitFaster.Caching.DependencyInjection</AssemblyName>
16-
<RootNamespace>BitFaster.Caching.DependencyInjection</RootNamespace>
17-
<Version>1.0.0</Version>
18-
<AssemblyVersion>1.0.0.0</AssemblyVersion>
19-
<FileVersion>1.0.0.0</FileVersion>
7+
<PackageProjectUrl></PackageProjectUrl>
8+
<Authors>Alex Peck</Authors>
9+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
10+
<Company />
11+
<Product>BitFaster.Caching</Product>
12+
<Description>BitFaster.Caching extensions for Microsoft.Extensions.DependencyInjection.</Description>
13+
<PackageTags>DependencyInjection</PackageTags>
14+
<PackageId>BitFaster.Caching.DependencyInjection</PackageId>
15+
<AssemblyName>BitFaster.Caching.DependencyInjection</AssemblyName>
16+
<RootNamespace>BitFaster.Caching.DependencyInjection</RootNamespace>
17+
<Version>1.0.0</Version>
18+
<AssemblyVersion>1.0.0.0</AssemblyVersion>
19+
<FileVersion>1.0.0.0</FileVersion>
2020
<IncludeSource>True</IncludeSource>
2121
<IncludeSymbols>True</IncludeSymbols>
2222
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
Extension methods for setting up caches using Microsoft.Extensions.DependencyInjection.
1+
Extension methods for setting up caches using Microsoft.Extensions.DependencyInjection.
2+
3+
# ConcurrentLru
4+
5+
To use with an `IServiceCollection` instance at startup:
6+
7+
```cs
8+
services.AddLru<int, int>(builder =>
9+
builder
10+
.WithCapacity(666)
11+
.Build());
12+
```
13+
14+
The builder delegate can be used to configure the cache, see the [wiki](https://github.com/bitfaster/BitFaster.Caching/wiki/ConcurrentLru-Quickstart#builder-api) for details.
15+
16+
There is an extension method for each [cache interface](https://github.com/bitfaster/BitFaster.Caching/wiki/Caches):
17+
18+
| Extension | Result |
19+
|-----------|--------|
20+
| AddLru | Registers `ConcurrentLru<int, int>` as a singleton `ICache<int, int>` |
21+
| AddAsyncLru | Registers `ConcurrentLru<int, int>` as a singleton `IAsyncCache<int, int>` |
22+
| AddScopedLru | Registers `ConcurrentLru<int, Disposable>` as a singleton `IScopedCache<int, Disposable>` |
23+
| AddScopedAsyncLru | Registers `ConcurrentLru<int, Disposable>` as a singleton `IScopedAsyncCache<int, Disposable>` |
24+
25+
26+
# ConcurrentLfu
27+
28+
To use with an `IServiceCollection` instance at startup:
29+
30+
```cs
31+
services.AddLfu<int, int>(builder =>
32+
builder
33+
.WithCapacity(666)
34+
.Build());
35+
```
36+
37+
The builder delegate can be used to configure the cache, see the [wiki](https://github.com/bitfaster/BitFaster.Caching/wiki/ConcurrentLfu-Quickstart#builder-api) for details.
38+
39+
There is an extension method for each [cache interface](https://github.com/bitfaster/BitFaster.Caching/wiki/Caches):
40+
41+
| Extension | Result |
42+
|-----------|--------|
43+
| AddLfu | Registers `ConcurrentLfu<int, int>` as a singleton `ICache<int, int>` |
44+
| AddAsyncLfu | Registers `ConcurrentLfu<int, int>` as a singleton `IAsyncCache<int, int>` |
45+
| AddScopedLfu | Registers `ConcurrentLfu<int, Disposable>` as a singleton `IScopedCache<int, Disposable>` |
46+
| AddScopedAsyncLfu | Registers `ConcurrentLfu<int, Disposable>` as a singleton `IScopedAsyncCache<int, Disposable>` |

0 commit comments

Comments
 (0)