redis_lua.getByUnique.lua Maven / Gradle / Ivy
The newest version!
-- 根据唯一索引取得
local table = KEYS[1];
local table_unique = KEYS[2];
local unique = KEYS[3];
-- 1.先根据索引取得主键
local primaryKey = redis.call('hget', table_unique, unique);
if (primaryKey) then
-- 2. 根据主键取得对象
return redis.call('hget', table, primaryKey);
else
return nil;
end
© 2015 - 2024 Weber Informatics LLC | Privacy Policy