What to use instead of memcache

I use memcache for caching (obviously), which is great. But I also use it as a cross-request / process data store. For example, I have a web chat on one of my pages, and I use memcache to store a list of online users in it. Works great, but it bothers me that if I need to reset the entire memcache server (for some reason), I will lose the online list. I also use it to write records for some content (I periodically update the actual rows in the DB), and if I clear the cache, I lose all data about the views (from the last record to db).

So, I ask: what should I use instead of memcache for this kind of thing? It should be fast and preferably stored in memory. I think some kind of noSQL product will fit well here, but I don't know which one. I would like to use something that I could use for other future use cases, analysts come to mind (for example, the users who are looking for the most).

I use PHP, so it should have good bindings for it.

+4
source share
2 answers

Redis ! This is similar to memcache on steroids (good view). Here are some drivers .

Redis is an extended keystore. It is similar to memcached, but the dataset is not volatile , and the values ​​can be strings, just like memcached, but also lists, sets, and ordered sets . All these data types can be manipulated using atomic operations to input / extrude elements, add / remove elements, perform server-side merging, intersection, difference between sets, etc. Redis supports various types of sorting.

+6
source

You can try memcachedb. It uses exactly the same protocol as memcache, but it is permanently stored.

You can also try cassandra or redis

+1
source

All Articles