Memcached if a free and open source distributed memory object caching system. It is used by web applications to lower database load by caching data in a key-value format for faster retrieval. If you happen to develop on Mac OS X, you can easily setup a development memcached server locally using MacPorts.

sudo port install memcached

Easy enough… Now, you can start the server by running

memcached -vv

Memcached is listening on port 11211.

One thing that memcached is used for is storing PHP sessions (memcached is distributed, rememer?) In order to do that, you must edit php.ini and set

session.save_handler = memcache
session.save_path = tcp://localhost:11211

Don’t forget to enable the extension and restart your Apache server.

Now, you can start storing data in memcache from your web app. If you wish/need to debug the value of a given key, you can simply do so using telnet

telnet localhost 11211
get foo
Filed under: Computing, Development, Mac OS X, PHP

Tagged with: , , , , , , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to Install and query Memcache on Mac OS X

1 Comment to "Install and query Memcache on Mac OS X"

  1. […] Install and query Memcache on Mac OS X […]

Name (required)

Email (required)


Leave a Reply

  • About Me

    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.