Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jitbit/FastCache
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-jitbit committed May 4, 2024
2 parents 07a5632 + fb8b1f1 commit a4b8631
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ cache.GetOrAdd(
valueFactory: k => 42,
ttl: TimeSpan.FromMilliseconds(100));

//handy overload to prevent captures/closures allocation
cache.GetOrAdd(
key: "answer",
valueFactory: (k, arg) => 42 + arg.Length,
ttl: TimeSpan.FromMilliseconds(100),
factoryArgument: "some state data");

```

## Tradeoffs
Expand Down

0 comments on commit a4b8631

Please sign in to comment.