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);
}