heisel.org

My first Django snippet: Another Memcache status view

Thursday | February 14, 2008 | 5:50 pm  

Hooray! I posted by first Django snip­pet today. It’s a status view for your mem­cache server(s).

I had orig­i­nally used this snip­pet, 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() func­tion. It returns a list of tuples — one for each server in your CACHE_BACKEND set­ting — the first item of each tuple is the server name/IP and port, the second item of the tuple is a dic­tio­nary with all the rel­e­vant stats you could need.

Permalink | Comments (0) | Categories: Django, Python, Technology

Comments

Be the first to post a comment!

Post a comment


Disclaimer: I work at The Atlanta Journal-Constitution. The opinions expressed here are my own, and do not reflect those of the AJC, Cox Newspapers, Cox Enterprises nor any other party.

Mail carrier N. Sorenson delivering Christmas mail through the snow. (Chicago Daily News/Chicago Historical Society)