StackExchange.Redis.Extensions
StackExchange.Redis.Extensions copied to clipboard
ISerializer,IRedisDatabase Non-generic Enhance
Hi@imperugo Let me describe the usage scenario.
GetAsync
Use GetAsync(cachekey, typeof(MyClass)) to return the type I want,.
//Now I have to do this to get the specified type.
var redisVlue = await _redisCacheClient.Db0.Database.StringGetAsync(cacheKey);
cacheValue = redisVlue.HasValue ? JsonSerializer.Deserialize(redisVlue, returnType) : cacheValue;
The test code is used to illustrate the usage scenarios for enhancing this function.
ubuntu-latest build failed, can you try again.
Hi @oTcom
I don't understand the need.
GetAsync<object>(...) isn't enought?
Hi @imperugo Thank you for coming back.
GetAsync<object>(...)
The return type is JObject, JDocment.
I can only get object types,So you cannot use generic methods.
What about a Custom Serializer that doesn't return JObject instead of that? Morver why you prefer object instead of T?
I am using dynamic proxy method to intercept. In this scenario, only the type of the object can be obtained, and the specific T cannot be obtained.