Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB is better replacement of Memcached? [closed]

Can we use MongoDB as a replacement of Memory Caching library (memcache and memcached).?

and what are the deference in MongoDB and Memory Caching Library.

like image 813
Ayaz Avatar asked Jan 11 '13 18:01

Ayaz


People also ask

Why MongoDB is better than Redis?

MongoDB is schemaless, which means that the database does not have a fixed data structure. This means that as the data stored in the database gets larger and larger, MongoDB is able to operate much faster than Redis. Redis is only significantly faster when the stored data is relatively small in size.

Why Redis is better than memcache?

When storing data, Redis stores data as specific data types, whereas Memcached only stores data as strings. Because of this, Redis can change data in place without having to re-upload the entire data value. This reduces network overhead.

Is Memcached still used?

Just a note: as it was confirmed by the current maintainer on Twitter, Memcached is still actively developed / maintained.


1 Answers

One of the main problems with MongoDB as a cache store is that it does not have expiration mechanism. More details about that you can find in this answer.

UPDATED Since MongoDB v2.2 it allows TTL for collections. Thanks to JohnnyHK for pointing.

I suggest to use Redis for caching and MongoDB as a database. They work nice together.

like image 183
Voldy Avatar answered Sep 19 '22 18:09

Voldy