django和memcached - 实际上是什么缓存?

时间:2012-03-11 11:01:09

标签: django memcached python-memcached

可能我只是期望从django缓存中得到太多,但以防我在这里遗漏了一些东西。

我已经安装了memcached(memcached,libmemcached和python-memcached)并将其配置为per this instruction

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

所以我启动了memcached并重新启动了应用程序服务器,但django似乎没有使用memcached。

stats (over 11211 port)
STAT pid 30582
STAT uptime 6574
STAT time 1331463502
STAT version 1.4.13
STAT libevent 2.0.17-stable
STAT pointer_size 32
STAT rusage_user 0.000000
STAT rusage_system 0.180011
STAT curr_connections 5
STAT total_connections 11
STAT connection_structures 6
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 81
STAT bytes_written 5172
STAT limit_maxbytes 16777216
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 262144
STAT hash_is_expanding 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END

1 个答案:

答案 0 :(得分:4)

声明缓存实际上并不使用它。 Django documentation指出了各种方法,您可以将Django配置为使用缓存,或在代码和模板中明确使用它。