API • Wiki • License • Roadmap • Contribute
How to use FiveM_Redis API
[[Get Redis Reference]]
local Cache = exports.fivem_redis:GetInterface();
[[Methods]]
-- Save data on Redis Cache | if not "expire_time" passed they will persistent
Cache.Save(key, value, expire_time)
-- Get data from Redis Cache
Cache.Get(key, function(result)
print(result)
end)
-- Remove data with informed key from Redis Cache
Cache.Invalidate(key)
-- Invalidate all data with informed prefix from Redis Cache
Cache.InvalidatePrefix(prefix, function(result)
print(result)
end)
-- Save an Sorted Data | (key,data - [array])
Cache.ZAdd("sortedSet",{1, "um", 2, "dois", 4, "quatro", 3, "três"})
-- Get an Saved Sorted Data | (key,range_min,range_max,arg)
Cache.ZRange("sortedSet", 0, 2, "WITHSCORES", function(result)
print(result)
-- ["um", "1", "dois", "2", "três", "3"] como se o comando fosse `redis> ZRANGE sortedSet 0 2 WITHSCORES`
end)
- See Install Instructions for detailed Instructions for install and use of Redis & RediSearch.
- Find on our roadmap the next steps of the project.
- Want to contribute? Follow these recommendations.