Last active
August 29, 2015 14:23
-
-
Save bzdgn/2e122f33678c91a1c340 to your computer and use it in GitHub Desktop.
Python Memcached Client Script
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
#!/user/bin/env python | |
import os | |
from time import sleep | |
import subprocess | |
import memcache | |
mclient = memcache.Client(['127.0.0.1:11211'], debug=0) | |
try: | |
while(True): | |
sleep(0.1) | |
user = mclient.get("user") | |
if(user!="clientA"): | |
mclient.set("user","clientA") | |
print("clientA: takeover") | |
except KeyboardInterrupt: | |
mclient.delete("user") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment