database - Can you read keys not explicitly specified in Redis Lua scripts? -


here example scenario illustrate:

suppose have key=>value pairs:

hmset thing1 name 'a thing' color red hmset thing2 name 'another thing' color green hmset thing3 name 'also thing' color blue 

and list values key names:

lpush things thing1 lpush things thing2 lpush things thing3 

my goal use indirection values range of things:

thingsarray = lrange things 0 2 each thing in thingsarray   result.push(hmget thing name color) 

but penalty round trips. realize can mitigated extent pipelining, hoping possible 1 round trip lua script. like:

eval superawesomescript 1 things 0 2 

the problem is, wouldn't know keys returned lrange call on "things" list @ time calling lua script. accessing data in way in lua script violate rules suggested future-proofing redis cluster?

i new redis , total noob lua, if way off base in goals, please tell me so. also, main concern multiple round trips network io, particularly within horizontally scaled cluster. so, entirely different solutions welcome well.

from eval docs:

the reason passing keys in proper way that, before eval redis commands analyzed before execution in order establish keys command operate on.

in order true eval keys must explicit. useful in many ways, in order make sure redis cluster able forward request appropriate cluster node (redis cluster work in progress, scripting feature designed in order play it). rule not enforced in order provide user opportunities abuse redis single instance configuration, @ cost of writing scripts not compatible redis cluster.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -