I'm trying to store an object into Cache like:

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

And I always get client.Store to be false, and it does not add to the server.

a few lines below this statement I also have:

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

and this always add into memory...

Is there a way to get the reason why I can't store the object?

Dictionary has around 95.000 records and in the configuration I have

<socketPool minPoolSize="10" 
            maxPoolSize="100" 
            connectionTimeout="00:01:00" 
            deadTimeout="00:02:00" />

P.S. I'm using Couchbase on localhost

有帮助吗?

解决方案

I m not sure because the code is not familiar..so i ask:Are you trying to store dictionary that is made of 95000 records? Membase is very similar to memcached, so I suggest to check if there is a limit for the size of the object you can store..as I know for memcached is 1mb

其他提示

You can use [ExecuteStore][1] method, which returns a IStoreOperationResult object instead of a bool, where you can find a message, exceptions, etc..
It doesn't always help, but it's worth a try.

EDIT: Use Couchbase .NET Client Library 1.1 for that.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top