A high-performance, thread-safe, pluggable in-memory caching executor for .NET developers. Supports optional async refresh, TTL-based expiry, and intelligent cache invalidation.
SmartCache.NET helps you reduce redundant computation and improve application responsiveness with:
- β‘ Thread-safe caching
- π Async refresh support
- π§ Smart locking & deduplication
- β±οΈ Configurable TTL
- π‘ Minimal setup β plug and play!
Just wrap your logic with Executor.Instance.GetDataAsync or GetData and get optimized performance out of the box!
var result = await Executor.Instance.GetDataAsync<string>(() => {
return ExpensiveComputation();
}, parameters, cacheDuration: 30, asyncRefreshAfterSecs: 120);dotnet add package SmartCacheNETOr Clone:
git clone https://github.com/MuhammadOmerKhan/SmartCache.NET.gitThe Program.cs demonstrates 10 concurrent calls using a shared cache key:
[Total CodeBlock Executions]: 1
[Total Time]: 505msEven with 10 parallel threads β only 1 execution happened. Thatβs the power of SmartCache.NET.
SmartCache.NET
/Executor.cs -> Core logic
/Program.cs -> Usage demo with benchmarkπ License
- MIT License. Do whatever you want β just give credit.
- Star π this repo
- Fork π΄ and submit a PR
- Raise issues or improvements