ToOptimizedResultUsingCache和Redis

时间:2013-04-20 20:13:11

标签: servicestack

我已将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
    });
}

感谢。

0 个答案:

没有答案