Eli : Memcached, MySQL, Highcharts

Using Memcached on Windows and Memcached telnet interface

How to install & run Memcached on Windows

  1. Download package from http://labs.northscale.com/memcached-packages/
  2. Unzip to your desired directory (c:\memcached_win32\ in my example)

Add memcached to the Windows services from the command line

c:\memcached_win32\memcached.exe -d install

Then you can start or stop the memcached server as a service with

net start memcached
net stop memcached

To edit the memcached server configuration, open regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached, then find and edit the ImagePath

"C:\memcached_win32\memcached.exe" -d runservice -m 256 -p 11210

Example running memcached with 256 M and on port 11210

Using Memcached telnet interface

You can communicate with memcached server (localhost or distant) by opening a telnet session.

Memcached text protocol can be found here

It's a bit confusing, but here some examples

Connecting to server :

> telnet localhost 11211

Server stats :

> stats
STAT pid 14550
STAT uptime 2530
[a lot of line...]

Slabs stats :

> stats slabs
STAT 1:chunk_size 80
[a lot of line...]

Items stats :

> stats items
STAT items:1:number 1
[a lot of line...]

Set command :

> set key 0 900 13
> data_to_store

Details on set command :

set <key> <flags> <exptime> <bytes> with <bytes> = number of bytes of data you want to store.

Get command :

> get
> get key
VALUE key 0 13

Increment & decrement commands :

> set key 0 900 2
> 10
> incr key 5
> decr key 2
> get key
VALUE key 0 2

You can also use phpMemCacheAdmin to execute these command and monitor your queries

Other Memcached Resources

You can find a lot of Memcached resources on this Memcached resources page.

Related Posts

comments powered by Disqus

You may also be interested in