0
ServiceStack.Redis를 사용하기 시작했습니다. 개별 키/값을 캐시에 넣고 캐시에서 가져올 수 있습니다. 그러나 모든 항목 또는 캐시의 항목 수를 얻을 수 없습니다.ServiceStack.Redis를 사용하여 항목 및 개수 얻기 IRedisTypedClient
은 여기 CustomerEntity 클래스에서 코드
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);
}