<分区>
Possible Duplicate:
Django cache.set() causing duplicate key error
我在使用 django 核心的数据库缓存时遇到了这个问题:
ERROR: duplicate key value violates unique constraint "cache_pkey"
STATEMENT: INSERT INTO "cache" (cache_key, value, expires) VALUES (E':1:cms-menu_nodes_en-us_1', E'gAJdcQEoY21lbnVzLmJhc2UKTmF2aW
LOG: server process (PID 8453) was terminated by signal 9: Killed
LOG: terminating any other active server processes
LOG: all server processes terminated; reinitializing
FATAL: could not create shared memory segment: Cannot allocate memory
DETAIL: Failed system call was shmget(key=5432001, size=29278208, 03600).
我查看了表格,果然,有一个键 ':1:cms-menu_nodes_en-us_1' 的条目。我发现了一个类似的问题 here ,但无法准确理解问题所在。
有人有什么想法或建议吗?听起来像是 django 核心中的错误,因为如果存在键,它应该更新记录。
编辑:我应该澄清一下数据库是 PostgreSQL 8.4.7。感谢 lazerscience。
编辑@Jack M:我无法重现此错误,但相信代码在django.core.cache.backends 中。 db.DatabaseCache
在调用 _base_set()
的名为 set()
的方法中。