FusionCache
FusionCache copied to clipboard
[FEATURE] 🪞 Remove all usage of reflection
Problem
Not technically a problem per se, but with the release of the new and improved auto-recovery in v0.24.0, I had to add a little bit of reflection usage to support a complex scenario of recovering some of the transient distributed errors scenarios.
Solution
I'd like to look back at that code and find a way remove reflection, mainly to:
- improve performance
- be better positioned for, eventually, playing with AOT (where reflection is basically a no-go)
Hi all, I just released v1.0.0-preview1 🥳
Please try it out so we can spot any potential issue before the official v1.0, thanks!
I see some usages of lock in the code, have you though about using Lazy<T> where possible? For example, FusionCache.cs / AutoRecovery uses a lock to generate if it doesn't exist, would it be more performance to use a lockless style instead?
Hi @celluj34 , I think it has an overhead over a simple double-checked lock, but I'll try asap and will let you know.
Anyway, take a look at Lazy<T> implementation...
Oh lol I never knew it used a lock under the hood. Well nevermind then! I always thought Lazy<T> was a good way to avoid locks in app code since they are blocking, but I guess it's locks all the way down...