我已将Redis客户端配置如下:
container.Register<IRedisClientsManager>( new PooledRedisClientManager("url"));
container.Register(c =>c.Resolve<IRedisClientsManager>().GetCacheClient());
在这种情况下,如果在执行ToOptimizedResultUsingCache方法期间生成异常,是否可以将其作为密钥存储在Redis中?
public object Get( MyRequest request)
{
return RequestContext.ToOptimizedResultUsingCache<RedisTestResponse>(base.Cache,
UrnId.Create<MyRequest >("all"), () =>{
//throw
});
}
感谢。