Skip to content

Commit 0686133

Browse files
authored
Update README.md
1 parent fc04a72 commit 0686133

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
High performance, thread-safe in-memory caching primitives for .NET.
44

5-
LRU implementations are intended as an alternative to the System.Runtime.Caching.MemoryCache family of classes (e.g. HttpRuntime.Cache, System.Web.Caching et. al.). MemoryCache makes heap allocations when the native object key is not type string, and does not offer the fastest possible performance.
6-
75
[![NuGet version](https://badge.fury.io/nu/BitFaster.Caching.svg)](https://badge.fury.io/nu/BitFaster.Caching)
86

97
# Installing via NuGet
@@ -22,6 +20,11 @@ LRU implementations are intended as an alternative to the System.Runtime.Caching
2220

2321
# Usage
2422

23+
## LRU: ClassicLru, ConcurrentLru, ConcurrentTLru
24+
25+
LRU implementations are intended as an alternative to the System.Runtime.Caching.MemoryCache family of classes (e.g. HttpRuntime.Cache, System.Web.Caching et. al.).
26+
27+
2528
## Caching IDisposable objects
2629

2730
All cache classes in BitFaster.Caching own the lifetime of cached values, and will automatically dispose values when they are evicted.
@@ -61,6 +64,15 @@ using (var handle = urlLocks.Acquire(url))
6164
```
6265

6366

67+
### Why not use MemoryCache?
68+
69+
MemoryCache is perfectly servicable. But in some situations, it can be a bottleneck.
70+
71+
- Makes heap allocations when the native object key is not type string.
72+
- Does not scale well with concurrent writes.
73+
- Executes code for perf counters that can't be disabled
74+
- Uses an heuristic to estimate memory used, and the 'trim' process may remove useful items. If many items are added quickly, runaway is a problem.
75+
6476
# Performance
6577

6678
## Lru Benchmarks

0 commit comments

Comments
 (0)