Skip to content

Commit 3185b99

Browse files
author
Alex Peck
committed
readme
1 parent 5c1e686 commit 3185b99

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,47 @@
11
# BitFaster.Caching.DependencyInjection
2-
Extension methods for setting up caches using Microsoft.Extensions.DependencyInjection.
2+
Extension methods for setting up [caches](https://github.com/bitfaster/BitFaster.Caching/wiki/Caches) using [Microsoft.Extensions.DependencyInjection](https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/).
33

44
# ConcurrentLru
55

6+
To use with an `IServiceCollection` instance at startup:
7+
68
```cs
79
services.AddLru<int, int>(builder =>
810
builder
911
.WithCapacity(666)
1012
.Build());
1113
```
1214

15+
The builder delegate is used to configure the registered cache, see the [wiki](https://github.com/bitfaster/BitFaster.Caching/wiki/ConcurrentLru-Quickstart#builder-api) for more details about the builder API.
16+
17+
There is an extension method for each [cache interface](https://github.com/bitfaster/BitFaster.Caching/wiki/Caches):
18+
19+
| Extension | Result |
20+
|-----------|--------|
21+
| `AddLru` | Registers `ConcurrentLru<int, int>` as a singleton `ICache<int, int>` |
22+
| `AddAsyncLru` | Registers `ConcurrentLru<int, int>` as a singleton `IAsyncCache<int, int>` |
23+
| `AddScopedLru` | Registers `ConcurrentLru<int, Disposable>` as a singleton `IScopedCache<int, Disposable>` |
24+
| `AddScopedAsyncLru` | Registers `ConcurrentLru<int, Disposable>` as a singleton `IScopedAsyncCache<int, Disposable>` |
25+
1326

1427
# ConcurrentLfu
1528

29+
To use with an `IServiceCollection` instance at startup:
30+
1631
```cs
1732
services.AddLfu<int, int>(builder =>
1833
builder
1934
.WithCapacity(666)
2035
.Build());
2136
```
37+
38+
The builder delegate is used to configure the registered cache, see the [wiki](https://github.com/bitfaster/BitFaster.Caching/wiki/ConcurrentLfu-Quickstart#builder-api) for more details about the builder API.
39+
40+
There is an extension method for each [cache interface](https://github.com/bitfaster/BitFaster.Caching/wiki/Caches):
41+
42+
| Extension | Result |
43+
|-----------|--------|
44+
| `AddLfu` | Registers `ConcurrentLfu<int, int>` as a singleton `ICache<int, int>` |
45+
| `AddAsyncLfu` | Registers `ConcurrentLfu<int, int>` as a singleton `IAsyncCache<int, int>` |
46+
| `AddScopedLfu` | Registers `ConcurrentLfu<int, Disposable>` as a singleton `IScopedCache<int, Disposable>` |
47+
| `AddScopedAsyncLfu` | Registers `ConcurrentLfu<int, Disposable>` as a singleton `IScopedAsyncCache<int, Disposable>` |

0 commit comments

Comments
 (0)