We are currently using memcache for storing session data. I have heard that memcached or redis are better. I need to understand what is the difference between them? in order to understand which one is the best choice
Asked
Active
Viewed 8,099 times
4
-
3Memcache and memcached in PHP are different extensions to access memcache; while memcache and redis are different key/value caching servers – Mark Baker Oct 17 '13 at 10:30
-
2Ses http://stackoverflow.com/questions/1442411/using-memcache-vs-memcached for a comparison between the memcache and memcached extensions – Mark Baker Oct 17 '13 at 10:31
-
3See http://stackoverflow.com/questions/10558465/memcache-vs-redis for a comparison between memcache and redis caching servers – Mark Baker Oct 17 '13 at 10:33
-
The answer depends on your use case. What are you storing in Memcache? As for generic differences, you can view the post by @ashiina below. – Manu Manjunath Nov 14 '13 at 07:01
2 Answers
10
This answer explains it very thoroughly. Memcached vs. Redis?
But if you want a simple answer, here it is:
Redis
- Persistent (your data lives even if your server shuts down/reboots, since it is written to your disk, unlike memcached)
- Supports lots of data types (list, sets, etc... not just a plain get/set/del like memcached)
Memcached
- fast
- easy to use
So basically, if you don't really care about the two big advantages of Redis, you should use memcached.
1
For your own use case I'd say Redis is better. Since you're using it to store user session data you probably have the need to perform operations on a single field of the session and for that the Redis hash data type is perfect. You can find a very detailed comparison between them in this article: Redis VS Memcached: Which one to choose?
![](../../users/profiles/13635318.webp)
Cristiano Vicente
- 11
- 1