My first Django snippet: Another Memcache status view

Hooray! I posted by first Django snippet today. It’s a [status view for your memcache server(s)](http://www.djangosnippets.org/snippets/597/).

I had originally used [this snippet](http://www.djangosnippets.org/snippets/54/), but the regex and socket thing never quite sat right with me.

Turns out that django.core.cache has a _cache object with a nice get_status() function. It returns a list of tuples — one for each server in your CACHE_BACKEND setting — the first item of each tuple is the server name/IP and port, the second item of the tuple is a dictionary with all the relevant stats you could need.

About Chris

Python developer, Agile practitioner trying desperately not to be a pointy haired boss.
This entry was posted in Django, Python, Technology. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s