No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Renovate Bot 81b7f8c391
All checks were successful
Build SimpleCache / build (push) Successful in 46s
chore(deps): update dependency xunit.runner.visualstudio to v4 (#39)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) | `3.1.5` → `4.0.0` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/xunit.runner.visualstudio/4.0.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/xunit.runner.visualstudio/3.1.5/4.0.0?slim=true) |

---

### Release Notes

<details>
<summary>xunit/visualstudio.xunit (xunit.runner.visualstudio)</summary>

### [`v4.0.0`](https://github.com/xunit/visualstudio.xunit/releases/tag/4.0.0)

[Compare Source](https://github.com/xunit/visualstudio.xunit/compare/3.1.5...4.0.0)

Release notes: <https://xunit.net/releases/visualstudio/4.0.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zMC4zIiwidXBkYXRlZEluVmVyIjoiNDQuMzAuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUiXX0=-->

Reviewed-on: #39
2026-08-16 19:09:51 +02:00
.forgejo/workflows chore(deps): update git.dutches.de/dutch/workflow-dotnet:9.0-10.0 docker digest to 8e5109e 2026-08-02 06:05:31 +00:00
SimpleCache chore: keep CacheEntry internal 2026-05-31 20:56:18 +02:00
SimpleCache.Benchmarks chore(deps): update dependency system.runtime.caching to 10.0.8 2026-05-12 17:56:30 +00:00
SimpleCache.Tests chore(deps): update dependency xunit.runner.visualstudio to v4 (#39) 2026-08-16 19:09:51 +02:00
.gitignore feat: initial implementation 2025-11-12 20:24:53 +01:00
LICENSE feat: initial implementation 2025-11-12 20:24:53 +01:00
README.md feat: initial implementation 2025-11-12 20:24:53 +01:00
renovate.json chore: renatove-groupallnonmajor 2025-11-12 21:48:41 +01:00
SimpleCache.sln feat: initial implementation 2025-11-12 20:24:53 +01:00

SimpleCache

A thread-safe caching library for .NET with support for different expiration strategies.

Features

  • Thread-safe concurrent access based on ConcurrentDictionary
  • Support for multiple expiration modes:
    • Time-to-live (TTL): Entries expire after a fixed duration
    • Sliding expiration: Entries reset their expiration timer on access
  • Automatic cleanup of expired entries
  • Lightweight and efficient implementation
  • No external dependencies

Benchmark

Method Mean Error StdDev Gen0 Allocated
DictionaryLookup 25.08 ns 0.755 ns 0.196 ns - -
SimpleCacheLookup (Sliding) 41.63 ns 0.244 ns 0.063 ns - -
SimpleCacheLookup (TTL) 38.66 ns 0.362 ns 0.094 ns - -
MemoryCacheLookup 239.41 ns 1.855 ns 0.482 ns 0.0076 128 B
SimpleCacheGetOrAdd (Sliding) 73.21 ns 2.523 ns 0.655 ns 0.0210 352 B
SimpleCacheGetOrAdd (TTL) 56.54 ns 0.792 ns 0.123 ns 0.0210 352 B
MemoryCacheGetOrAdd 524.66 ns 9.418 ns 1.457 ns 0.0687 1152 B
SimpleCacheAddRemove (Sliding) 49.43 ns 1.366 ns 0.355 ns 0.0105 176 B
SimpleCacheAddRemove (TTL) 49.17 ns 2.132 ns 0.330 ns 0.0105 176 B
MemoryCacheAddRemove 298.84 ns 5.938 ns 0.919 ns 0.0191 320 B

Usage Examples

Basic Usage

// Create cache
var cache = new SimpleCache<string, int>(ExpirationMode.TimeToLive);

// Add items to cache
cache.AddOrUpdate("counter", 1, TimeSpan.FromMinutes(5));

// Get items from cache
if (cache.TryGet("counter", out int value))
{
    Console.WriteLine(value); // Outputs: 1
}

// Get item from cache, or add if not found
int value = cache.GetOrAdd("counter", () => 2, TimeSpan.FromHours(1));
Console.WriteLine(value); // Outputs: 1

NuGet

To download this package as a NuGet, a new NuGet source has to be added:

dotnet nuget add source https://git.dutches.de/api/packages/Dutch/nuget/index.json -n "Dutch@DutchGit"

License

MIT License