Skip to content

Commit a4b8631

Browse files
committed
Merge branch 'main' of https://github.com/jitbit/FastCache
2 parents 07a5632 + fb8b1f1 commit a4b8631

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ cache.GetOrAdd(
7070
valueFactory: k => 42,
7171
ttl: TimeSpan.FromMilliseconds(100));
7272

73+
//handy overload to prevent captures/closures allocation
74+
cache.GetOrAdd(
75+
key: "answer",
76+
valueFactory: (k, arg) => 42 + arg.Length,
77+
ttl: TimeSpan.FromMilliseconds(100),
78+
factoryArgument: "some state data");
79+
7380
```
7481

7582
## Tradeoffs

0 commit comments

Comments
 (0)