python - memcache 不会存储键/值,因为值太大

标签 python django memcached key-value

cache.set(key, Biglist, 3600)
print cache.get(key)

当我的“Biglist”是一个包含大量内容的巨大列表时,它似乎无法存储。

但是当我将其更改为像“abc”这样的小文本时,它会存储。

我必须配置什么才能将我的内存缓存设置为接受无限大小的键/值?

最佳答案

参见What is the maximum data size you can store常见问题解答部分。

What is the maximum data size you can store? (1 megabyte)

The maximum size of a value you can store in memcached is 1 megabyte. If your data is larger, consider clientside compression or splitting the value up into multiple keys.

Why are items limited to 1 megabyte in size?

Ahh, this is a popular question!

Short answer: Because of how the memory allocator's algorithm works.

关于python - memcache 不会存储键/值,因为值太大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2917484/

相关文章:

python - 在 Django 中获取反序列化对象的主键

php - Django 中的 ORM 与 PHP Doctrine

php - 检查 Memcache 中是否存在键

memcached - 是否存在可以将更改通知外部实体的内存中键/值存储?

python - 当某些项目相互依赖时,如何运行异步进程列表?

Python 日期时间格式化 - 将字符串格式化为指定格式

python - 如何从这个单词矩阵创建句子排列?

python - Django:在数据库中不存在的两个日期范围之间进行分组

memcached - 如何查看memcache中的数据?

python - Pandas :根据另一列条件使用应用功能