0

I have inserted one ArrayList into a Redis database using Java.

hashList.leftPushAll("myKey", fetchedCatalogs);

Here, myKey is the key and fetchedCatalogs is a ArrayList which contain some data.

Now I want to fetch this list in Java but I am not able to do it. Please help.

lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
HBG
  • 1
  • 1
  • 1
  • Tutorial suggests `List list = jedis.lrange("myKey", 0, 5);`, what do you mean by "I am not able to do it" ? – Hugues M. May 08 '17 at 11:20
  • I have already tried what you have suggested but using this I can fetch only maximum 5 records. what if I have n numbers of records. How to implement that ? – HBG May 08 '17 at 12:29
  • Possible duplicate of [How to get multiple list values in one single call in RedisTemplate of Jedis Client](http://stackoverflow.com/questions/31898215/how-to-get-multiple-list-values-in-one-single-call-in-redistemplate-of-jedis-cli) – Hugues M. May 08 '17 at 12:31
  • Instead of 5 use -1 for the penultimate member. Read the docs about https://redis.io/commands/lrange. Note that if you're always reading/writing the entire array a List is less than ideal - just serialize the entire thing and store it as a string – Itamar Haber May 08 '17 at 15:32

0 Answers0