Created
January 10, 2013 08:00
-
-
Save thoas/4500306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import telnetlib | |
import os | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'madmoizelle.settings' | |
from django.conf import settings | |
from django.core.cache import cache | |
host = '127.0.0.1' | |
port = 11211 | |
t = telnetlib.Telnet(host, port) | |
t.write('stats cachedump 3 10000 END\n') | |
items = t.read_until('END').split('\r\n') | |
for item in items: | |
if item.startswith('ITEM :1:sorl-thumbnail'): | |
cmd = 'delete %s\n' % item[5:63] | |
t.write(cmd) | |
print cmd | |
print t.read_some() | |
elif item.startswith('ITEM :1:eros_'): | |
cmd = 'delete %s\n' % item[5:41] | |
t.write(cmd) | |
print cmd | |
print t.read_some() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment