10

I have a redis key/value store holding blobs (size in the tens of MB), and the jedis client I am using in my java application returns a byte array from the jedis connection's get method. Currently, I have to wrap the result in a stream in order to process the bytes. Are there any alternatives that would allow me to stream the result directly? other clients or ways to use Jedsi? thanks for any advice.

brendon
  • 363
  • 3
  • 11
  • AFAIK I don't think you can stream the result of a jedis query. – zenbeni Aug 22 '14 at 09:26
  • if you want to stream, you should jump to another redis lib that is specialized on streaming shipwire/redis. This lib is written in GO. – jeorfevre Nov 13 '15 at 20:18
  • (also but only as an advice, redis is really fast at key/store level with datas that are small & replicated) for the storage of bigger datas that I assume are video, music or images, why not to use a more traditional DB, that supports streaming natively in there drivers ? – jeorfevre Nov 13 '15 at 20:20

2 Answers2

2

If you don't find any available existing driver to perform what you like, You can calling directly redis from your java code.

The protocol used by a redis server, RESP (REdis Serialization Protocol) is very simple. I studied it and implemented a complete java driver, just to test my abilities in less than half day. Here is the link to RESP specification. You can for example start from an existing driver and add a custom functionality to stream the data as you like.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56
0

There is no mentioned types for storing large object in redis.

But you can store it as string and for buffered streaming you can use GETRANGE command of redis which returns string for given range .

Get length of data using GETLEN. Use redis pipeline to create series of GETRANGE command to read different pages of data. Similarly to set data you can use SETRANGE command.

Ref: redis commands

Please find specific implementation of mentioned redis commands in your redis java client.

Heera Jaiswal
  • 681
  • 5
  • 3