Skip to content

Commit fb8b1f1

Browse files
authored
Update README.md
1 parent d5d937a commit fb8b1f1

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)