Use Redis em Adonis
'use strict'
const Redis = use('Redis')
Redis.subscribe('music', async (track) => {
console.log('received track', track)
})
DJ Benny
'use strict'
const Redis = use('Redis')
Redis.subscribe('music', async (track) => {
console.log('received track', track)
})
const Redis = use('Redis')
const user = {
username: 'foo',
email: '[email protected]'
}
// set user
await Redis.hmset('users', user.username, JSON.stringify(user))
// get user
const user = await Redis.hmget('users', user.username)
const Redis = use('Redis')
Redis.publish('music', track)