For the memcache category

Installing memcached to use it with php

No Comments

Installing Memcached with php support in Ubuntu is a matter of a few steps:

sudo apt-get install memcached php5-memcached
sudo service apache2 restart

You can test if memcached is active by running this command:
echo "stats settings" | nc localhost 11211
You will end up with a response like this one:

STAT maxbytes 67108864
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 11211
STAT inter

STAT item_size_max 1048576
STAT maxconns_fast no
STAT hashpower_init 0
STAT slab_reassign no
STAT slab_automove 0

Script listing all the keys on a memcache server

No Comments

This script lists all the keys on a memcache server.

nc localhost 11211 > /tmp/$$.1 <<EOF
stats items
cut -d: -f2 /tmp/$$.1 | grep -v END | uniq  | sed 's/^/stats cachedump /' \ 
   | sed 's/$/ 1000/' > /tmp/$$.2
nc localhost 11211 < /tmp/$$.2 | grep -v '^END' | sort 
rm /tmp/$$.[12]
Blue Taste Theme created by Jabox