Using Lettuce save and query JSON String in Redis memory database

4 views
Skip to first unread message

Bao Quach

unread,
Sep 17, 2020, 9:21:03 AM9/17/20
to lettuce-redis-client-users
Hi All

Can you please let me know how to Lettuce save and query JSON String in Redis memory database.

Here is an example of my JSON String

{"regionId":1,"siteId":611,"detId":100061100240224,"version":0,"recTime":1597042508379,"dataId":5016892592456515000,"rawDataId":981518856161479700,"imageDataId":-1,"vehicles":null,"pedestrians":null,"events":[{"laneId":"1eabfced-2857-608c-b45c-54bf648fb0a3","laneNum":2,"eventNumber":1342204,"beginEventNumber":1342168,"confidence":90,"eventLevel":0,"eventType":"Presence","classType":0,"eventState":"End","trackedObjectId":0,"position":{"x":0,"y":0},"message":"Presence End","detTime":"2020-08-10T16:55:19.142+10:00","zoneId":1}],"obuVehicles":null,"bicycles":null}

I am currently using RedisAsyncCommands.setex( key, expireTime, messageJsonStr);
to save Redis where key = eventData-1597042508379 and expireTime = 2 x 24 x 60 X60 // 7 days

know the keys, I range of JSON Array String  RedisAsyncCommands.getrange(key, start, end)

But, I would like the retrieve this Event Data JSON string by searching for field such as siteId, or rawDataId or eventType. using SQL select like query

Can you please provide Java Lettuce  example how, I can achieve this.

Thank you for your help

Regards, Bao


Thank you for your help



Reply all
Reply to author
Forward
0 new messages