0
我刚开始使用ServiceStack.Redis。我可以将各个键/值放入缓存并从缓存中获取它们。但是,我似乎无法获取缓存中的所有项目或计数项目。使用ServiceStack.Redis获取项目和计数IRedisTypedClient
下面的代码
using (RedisClient cacheClient = new RedisClient(cacheServer))
{
IRedisTypedClient<CustomerEntity> customerCache = cacheClient.As<CustomerEntity>();
customer = bl.FetchCustomer(customerId);
//cache for two minutes
customerCache.SetEntry(customerId, customer, new TimeSpan(0, 2, 0));
//These all show the count as 0
logger.Debug(customerCache.GetAll().Count);
logger.Debug(cacheClient.GetAll<CustomerEntity>().Count);
var customers = customerCache.GetAll();
logger.Debug("{0} customers in the cache", customers.Count);
}