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 SmartCacheNET
Or Clone:
git clone https://github.com/MuhammadOmerKhan/SmartCache.NET.git
The Program.cs demonstrates 10 concurrent calls using a shared cache key:
[Total CodeBlock Executions]: 1
[Total Time]: 505ms
Even 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