【发布时间】:2012-01-11 22:00:17
【问题描述】:
我正在尝试将对象存储到缓存中,例如:
Dictionary<Guid, Decimal> cacheSubscribers =
client.Get<Dictionary<Guid, Decimal>>("ListAllSubscribers");
if (cacheSubscribers == null)
{
cacheSubscribers = db.JK_Subscribers
.Where(x => x.sync)
.Select(x => new { x.guid, x.subscriber_id })
.ToDictionary(x => x.guid, x => x.subscriber_id);
if (!client.Store(StoreMode.Set, "ListAllSubscribers", cacheSubscribers, ts))
MessageBox.Show("Could not store ListAllSubscribers");
}
而且我总是把client.Store 变成false,它不会添加到服务器中。
这句话下面几行我也有:
IEnumerable<JK_ChallengeAnswers> challengeAnswers = client.Get<IEnumerable<JK_ChallengeAnswers>>("ListAllChallengeAnswers");
if (challengeAnswers == null)
{
challengeAnswers = db.JK_ChallengeAnswers.Include("JK_Challenges").ToList();
client.Store(StoreMode.Set, "ListAllChallengeAnswers", challengeAnswers, ts);
}
而这总是添加到记忆中...
有没有办法得到我不能存储对象的原因?
Dictionary 有大约 95.000 条记录,在我的配置中
<socketPool minPoolSize="10"
maxPoolSize="100"
connectionTimeout="00:01:00"
deadTimeout="00:02:00" />
附:我在localhost上使用Couchbase
【问题讨论】:
标签: c# winforms memcached couchbase enyim