Let me introduce Redis…
Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes,lists, sets and sorted sets.
You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.
In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log.
Redis also supports trivial-to-setup master-slave replication, with very fast non-blocking first synchronization, auto-reconnection on net split and so forth.
Other features include a simple check-and-set mechanism, pub/sub and configuration settings to make Redis behave like a cache.
You can use Redis from most programming languages out there.
Redis is written in ANSI C and works in most POSIX systems like Linux, *BSD, OS X and Solaris without external dependencies. There is no official support for Windows builds, although you may have some options.
Redis is a must-have for any modern LAMP stack. Its 2.2.1 release is now available on Dotdeb for Debian 6.0 “Squeeze” in amd64 and i386 flavors. If you want to use it with PHP, please install the php5-redis package.
Links :
9 replies on “Redis : a must-have for your LAMP stack”
One word. AWESOME
I really like the idea to use Redis as PHP’s session storage, but – same problem as with memcached – I’m in need for a function that gives me a list of all active (= non-expired) session Id’s, since my app has to do some (database-)cleanup tasks on expired sessions. Is that possible with Redis as session handler? With memcached it’s not.
@Laph : Redis can list the stored keys with the “KEYS *” command
This is possible with memcached too : http://www.darkcoding.net/software/memcached-list-all-keys/
Thanks for answering. I’ll go for redis since the keys command seems much simpler to me. 🙂 Additionally, when using memcached as PHP’s session handler, I’ve never managed that expired sessions were REALLY deleted. As far as I know, in memcached expired keys are only pruned, when memcached runs out of free memory. And redis seems to support a real TTL for keys.
The current dot deb package fro redis is version 2.2.1
When will the redis version 2.2.2 be available as a dot deb package
@gavin : I will maintain Redis and I will publish up-to-date package as often as I can, with stability and production features in mind. But you may have to wait some days after the official release for the packages being released. Redis 2.2.2 is in my TODO.
Thank you for the update
anyone have idea if there is memcached to redis abstraction layer for php ? e.g. you use memcache_get() and it internally change it to $redis->get()