Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Memcached在django中尝试100多个k,v对时,set_many和get_many失败。为什么?_Django_Memcached - Fatal编程技术网

Memcached在django中尝试100多个k,v对时,set_many和get_many失败。为什么?

Memcached在django中尝试100多个k,v对时,set_many和get_many失败。为什么?,django,memcached,Django,Memcached,我有一个要缓存的数据字典,因此我使用: cache.set_many(dict_to_cache, TTL) 对于一本词条超过100条的词典来说,它似乎没有设置。没有抛出错误,而且似乎没有任何东西被逐出,只是没有保存。我的工作是通过一种方法将字典分解成100个关键块: def dict_chunker(data, SIZE=100): it = iter(data) for i in xrange(0, len(data), SIZE): yield {k:da

我有一个要缓存的数据字典,因此我使用:

cache.set_many(dict_to_cache, TTL)
对于一本词条超过100条的词典来说,它似乎没有设置。没有抛出错误,而且似乎没有任何东西被逐出,只是没有保存。我的工作是通过一种方法将字典分解成100个关键块:

def dict_chunker(data, SIZE=100):
    it = iter(data)
    for i in xrange(0, len(data), SIZE):
        yield {k:data[k] for k in islice(it, SIZE)}
这似乎很好,但我想知道是什么原因使它不适用于超过100个词条的词典

我一次拿到100多把钥匙也有同样的问题

dict = cache.get_many(list_of_keys)

有人知道为什么会这样吗?

这是一本特别庞大的词典吗?对象有1Mb的限制,感谢您的回复!不。。。但即使是这样,它不应该有某种错误吗?我的第一个倾向是它确实是,大小,但我相信“对象”是每个单独的条目。。。不是整本字典。我的条目远低于1Mb。