Storing and retrieving files is redis


I need to store documents using redis. Like we use collections in mongoDB. Is there any such utility available in Redis. or any other hack to do it?

You can do a JSON dump and just store them as key-value

If needed, you can add some basic indexing capabilities using SET.

Here is some code I wrote some time ago to have stuff on the top of Redis:

  • It stores JSON serialisation of complex Python objects

  • There is a basic index “sort by date” created using ZADD

If with “files” you mean binary data, then Redis key value store happily accepts bytes as payload (it internally uses bytes, usually string data is encoded as utf-8).