Replies: 1 comment 3 replies
-
Hi @miqbalrr, If you're in your User model you can simply do this : It's documented here: https://adonisjs.com/docs/4.1/database-hooks#_binding_closure Cheers |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to create a new event that will delete cache after data saved into database.
i have caching system use redis, from another app in adonis with key as logged user.
so i need the user id from model to delete cache by specifiec key.
this.addHook('afterSave', async() => {
const data = {key: "prefix_userID"}
Bull.add(ClearCacheJobs.key, data )
})
thankyou.
Beta Was this translation helpful? Give feedback.
All reactions