Redis atomic transaction to search by intersectioning set and use returned data to update -
redis experts, want search idle data type resource , mark not idle, in 1 command (atomic).
i using redis keep tab of active resources different type. how should approach problem of mine, need hash data querying field values, i've created own set , using sinter
, update flag in use. reference how filtering in redis using set http://robots.thoughtbot.com/redis-set-intersection-using-sets-to-filter-data
let's want find id of 1 idle resource type x , attribute a, query using intersect on type
set , attribute
a. using command sinter s:type:x s:attribute:a s:active:false
. return id of resource #400, want use number hgetall , update active become true, (hgetall s:resource:400
).
and need atomic. right i'm still trying in multi/exec. please advice if there easier way.
use lua scripting. it's scripting language redis uses. can load script redis , execute script atomically. lookup eval, script load, , evalsha commands of redis , search "lua script redis" on google.
Comments
Post a Comment