10. December 2021
Redis Lua scripts
Redis custom Lua scripts
Since @adonisjs/[email protected]
it’s now possible to add custom Lua scripts to Redis commands
import Redis from '@ioc:Adonis/Addons/Redis'
Redis.defineCommand('defineValue', {
numberOfKeys: 1,
// Custom Lua script
lua: `redis.call('set', KEYS[1], ARGV[1])`,
})
await Redis.runCommand('defineValue', 'greeting', 'hello world')