Skip to content

Commit fb5c7c5

Browse files
authored
package readme (#254)
* package readme * link * codeql win * wiki * heading2
1 parent 26adca8 commit fb5c7c5

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: windows-latest
2727
permissions:
2828
actions: read
2929
contents: read

BitFaster.Caching/BitFaster.Caching.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<Product>BitFaster.Caching</Product>
88
<Description>High performance, thread-safe in-memory caching primitives for .NET.</Description>
99
<PackageLicenseFile>LICENSE</PackageLicenseFile>
10+
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
1011
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1112
<Version>2.0.0</Version>
1213
<Copyright>Copyright © Alex Peck $([System.DateTime]::Now.ToString(yyyy))</Copyright>
@@ -34,6 +35,7 @@
3435
<Pack>True</Pack>
3536
<PackagePath></PackagePath>
3637
</None>
38+
<None Include="README.md" Pack="true" PackagePath="\" />
3739
</ItemGroup>
3840

3941
<ItemGroup>

BitFaster.Caching/ReadMe.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ⚡ BitFaster.Caching
2+
3+
High performance, thread-safe in-memory caching primitives for .NET.
4+
5+
## ConcurrentLru
6+
7+
`ConcurrentLru` is a light weight drop in replacement for `ConcurrentDictionary`, but with bounded size enforced by the TU-Q eviction policy (similar to [2Q](https://www.vldb.org/conf/1994/P439.PDF)). There are no background threads, no lock contention, lookups are fast and hit rate outperforms a pure LRU in all tested scenarios.
8+
9+
Choose a capacity and use just like ConcurrentDictionary, but with bounded size:
10+
11+
```csharp
12+
int capacity = 666;
13+
var lru = new ConcurrentLru<string, SomeItem>(capacity);
14+
15+
var value = lru.GetOrAdd("key", (key) => new SomeItem(key));
16+
```
17+
18+
## ConcurrentLfu
19+
20+
`ConcurrentLfu` is a drop in replacement for `ConcurrentDictionary`, but with bounded size enforced by the [W-TinyLFU eviction policy](https://arxiv.org/pdf/1512.00727.pdf). `ConcurrentLfu` has near optimal hit rate. Reads and writes are buffered and replayed asynchronously to mitigate lock contention.
21+
22+
Choose a capacity and use just like ConcurrentDictionary, but with bounded size:
23+
24+
```csharp
25+
int capacity = 666;
26+
var lfu = new ConcurrentLfu<string, SomeItem>(capacity);
27+
28+
var value = lfu.GetOrAdd("key", (key) => new SomeItem(key));
29+
```
30+
31+
## Documentation
32+
33+
Please refer to the [wiki](https://github.com/bitfaster/BitFaster.Caching/wiki) for full API documentation, and a complete analysis of hit rate vs cache size, latency and throughput.

0 commit comments

Comments
 (0)