I'm not good at Python, but if I understood you correctly, you have need retain Type type and string val into cache. In this case you can define a new class and implements properties for these params or use Tuple types.
ASP.NET Core or .NET 5 have ready implementation of cache
This is a simple implementation of cache.
If you use threads, then better use Concurrent Dictionary.
docs.microsoft.com/dotnet/api/syst...
For example:
What if I want to retain the original value(s) of the parameters, like Python's LRU cache?
I'm not good at Python, but if I understood you correctly, you have need retain Type type and string val into cache. In this case you can define a new class and implements properties for these params or use Tuple types.
ASP.NET Core or .NET 5 have ready implementation of cache
For example
Or for C# 9
Okay. Thanks for your help.