Last active
January 31, 2021 10:32
-
-
Save Aung-Myint-Thein/a83af61a9e586a20f0005922dccc8d62 to your computer and use it in GitHub Desktop.
Sample function call to redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { getCachedDataByKey, setDataToCache } = require('../../redis'); | |
const checkUser = async (user_id, item) => { | |
let user_access = await getCachedDataByKey("item_access_" + item + "_" + user_id); | |
if (!user_access) { | |
// get the data from database for user_id for item and assign to user_access | |
setDataToCache("item_access_" + item + "_" + user_id, user_access); | |
} | |
return user_access; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment