Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between memcache, memcached and redis

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

like image 414
Charanjeet Kaur Avatar asked Dec 16 '22 05:12

Charanjeet Kaur


2 Answers

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.

like image 102
ashiina Avatar answered Jan 04 '23 04:01

ashiina


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?

like image 21
Cristiano Vicente Avatar answered Jan 04 '23 03:01

Cristiano Vicente