database - Querying REDIS with HMSET -
i using redis data store , have created hmset like:
hmset key:1 source 5 target 2 hmset key:2 source 3 target 1 hmset key:3 source 3 target 5 hmset key:4 source 6 target 2 hmset key:5 source 2 target 3
now, want query these keys based on provided source , target list. suppose, list of source , target [2, 3, 6]
i want have query
select key source in[2, 3, 6] , traget in[2, 3, 6]
which give me result
key:4 source 6 target 2 key:5 source 2 target 3
with dataset (only few sets), option iterate them (either in lua script or fetching app) , filtering inspecting hashes.
to speed things up, maintain secondary indexes (again, effort yours). like:
sadd source:3 key:2 key:3 sadd target:2 key:1 key:4
then can relatively find matching keys issuing sinterstore
command
sinterstore found_keys source:2 source:3 source:6 target:2 target:3 target:6
you'll have keys seek under found_keys
name.
although, if find this, should ask yourself: why don't give , use sql-capable database, because want one.
Comments
Post a Comment