How to know if memcached is doing anything

djangodjango-cachememcached

I'm testing out using memcached to cache django views. How can I tell if memcached is actually caching anything from the Linux command line?

Best Answer

I know this question is old, but here is another useful approach for testing memcached with django:

As @Jacob mentioned, you can start memcached in very verbose mode (not as a daemon):

memcached -vv

To test your django cache config, you can use the low-level cache api.

  1. First, start up the python interpreter and load your django project settings:

    python manage.py shell
    
  2. From the shell, you can use the low-level cache api to test your memcache server:

    from django.core.cache import cache
    cache.set('test', 'test value')
    

If your cache configuration is correct, you should see output in memcache similar to this:

<32 set :1:test 0 300 10
>32 STORED
Related Topic