Thx Man ! I'm using Redis for my own project and it's working so far. But I didn't know about the built in promisify function in node lol. I can say it helps a lot because it's was a hard work to deal with the callback on each Redis GET function ( GET, HGET, HGETALL ... ). I was watching this kinda video just to find things like this, little but very helpful. This video is one top of that very clear for beginners.
The latest version of redis is asynchronous so no need to make custom functions. You can simply use the client. For instance, const reply = await client.GET(`rockets`) await client.setEx("recipes", 5, JSON.stringify(response.data)) const reply = await client.GET(`rocket-${id}`) await client.setEx(`rocket-${id}`, 5, JSON.stringify(response.data))
Priceless tutorial thank you keep it up. great vibe and flow man thank you. just couple Qs please 1. How long can is it ok to keep cache if data is not changing often? 2. What do I need to to do in order to deploy apps with Redis? cheers bro
One more question..how much memory it requires to handle proper redis and in what type of application redis can be used...small applications? Thank you so much for your previous answer
@@mafiacodes node API's using JEST , i know that testing can't be covered in one video & it should be an entire series but you can make a usefull one & if there is a feedback from your community, you can do more (unit, integration, e&e)
I have one question ..what if we have database and web server both on same machine.will it be useful to use redis cache or we can make direct call because server and database are on same machine?
If ur doing server side rendering, then u shud use a templating engine like “EJS”, you can watch this video to see how ejs works ruclips.net/video/BXuR6ucscJk/видео.html though it’s a video to create short links but ejs part remains the same.
@@mafiacodes Actually my questions was incorrect, it was about caching the html itself and rendering cached html rather than data(json). Wanted to implement this: res.render('showList',{shows:data},async(err,html)=>{ await client.setAsync('movieList',html); res.send(html); Thank you. I watched the ejs video too.
A cache's primary purpose is to increase data retrieval performance by reducing the need to access the underlying slower storage layer. In a messaging app or notifications - data is fetched quickly, so should you cache - NO.
misleading kids ...this is simple backlink to api....stupid routing...not a single page in real time show..forget this restclı..is macbook cach localshit has no reflection to real server to customer location...blender ..in general what common it guys shows ytb views generating ...sorry nogo
return Promise.reject(new errors_1.ClientClosedError()); ^ ClientClosedError: The client is closed at Commander._RedisClient_sendCommand (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\@redis\client\dist\lib\client\index.js:490:31) at Commander.commandsExecutor (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\@redis\client\dist\lib\client\index.js:188:154) at BaseClass. [as get] (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\@redis\client\dist\lib\commander.js:8:29) at node:internal/util:364:7 at new Promise () at Commander. (node:internal/util:350:12) at C:\MY WORKS\NODE\Node Small Projects\Node-caching\index.js:19:25 at Layer.handle [as handle_request] (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\express\lib outer\layer.js:95:5) at next (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\express\lib outer oute.js:144:13) at Route.dispatch (C:\MY WORKS\NODE\Node Small Projects\Node-caching ode_modules\express\lib outer oute.js:114:3) Node.js v18.12.1 This error is occurring when running your code, please advice
The Best Video I Got It After Searching 3 consecutive days
Just discovered your channel and I’m binge watching all your nodejs videos. Thank you for this🙌🏻🔥
Same here 💫
Thank you for this video bro... Really this is helpful for my new project... Clear explanation.... Thank you so much man... keep rocking...
I used Redis with Php, I found an excelent video and explanation for Node Js. Congrats! Thank U!!
very well explained. i never found out how to use redis. the answer is here. please do come up with more such videos.
Subscribe like
Kudos. Great job and really well done - bare minimum dependencies to demonstrate the basics of get/set within a Node environment. Thank you!
Glad you enjoyed it!
Wow this is some of the cleanest code I've seen in a while. Thank you.
You're welcome!
Thx Man ! I'm using Redis for my own project and it's working so far. But I didn't know about the built in promisify function in node lol. I can say it helps a lot because it's was a hard work to deal with the callback on each Redis GET function ( GET, HGET, HGETALL ... ). I was watching this kinda video just to find things like this, little but very helpful. This video is one top of that very clear for beginners.
Great to hear! Subscribe like share...
@@mafiacodes for sure
Best tutorial for redis. Thanks man. I like the way you write code(like me😀). Clean and easy to understand.
Thanks for this! Your explanation was very clear and it was very easy to grasp everything. Looking forward to learning more about Redis caching.
Glad it was helpful!
your videos are direct to the point everytime. I like this
thank you so much, earlier I thought implementation of radis will be tough. Thankx alot
The latest version of redis is asynchronous so no need to make custom functions. You can simply use the client.
For instance,
const reply = await client.GET(`rockets`)
await client.setEx("recipes", 5, JSON.stringify(response.data))
const reply = await client.GET(`rocket-${id}`)
await client.setEx(`rocket-${id}`, 5, JSON.stringify(response.data))
thx a lot
thanks
no problem
Thanks for sharing bro. Regards from Mexico 🇲🇽.
My pleasure!
Elegant piece of code. Thank you.
Previously i thought it was difficult to use redis but after this video i am able to do it in 30min💥nice video much love bro❤💥
This is exactly what I was looking for , I am a beginner...Thank you for this video...
Glad that you like 😊
i'm sharing your videos and it's the least i can do , thanks for sharing your knowledge
Thanks a lot. clear cut and clean too
You are tooo good man.... Love you brother :)
Thank you so much 😀
Subscribe like share
Priceless tutorial thank you keep it up. great vibe and flow man thank you. just couple Qs please
1. How long can is it ok to keep cache if data is not changing often?
2. What do I need to to do in order to deploy apps with Redis?
cheers bro
Same questions
Thanks for the tutorial its really very helpful. 😊
Great video bro, You are awesome !!
Sir which host we should mention when deploying server
Sir , please make a video on what to do if we have backend as MongoDB, that is how to integrate Redis with MongoDB. Thanks, you are the best.
Superb video
easy to understand, thank you :))
You have got a new follower)
One more question..how much memory it requires to handle proper redis and in what type of application redis can be used...small applications? Thank you so much for your previous answer
For production atleast 2gb ram
@@mafiacodes thank you so much
Hi,
Can i use this if I am changing my api's data every other day?
Yes, provide a refresh interval related to ur use case
thank you soo much brother!!!
will be great if you can make a video on testing for our API & add it to this series cant wait & thanks
stay motivated you're awesome !
Which API?
@@mafiacodes node API's using JEST , i know that testing can't be covered in one video & it should be an entire series but you can make a usefull one & if there is a feedback from your community, you can do more (unit, integration, e&e)
Awesome tutorial ! can you tell me how to can i set font style which you have set on your vscode?
Operator mono font
Which color theme and font are using for the editor and terminal?
Asusual another useful tutorial at the right time. Thanks bro
bhai konsi theme and font use kar rhe ho
Thanks
Thank you and vs code theme name please
Great man ,
@yours truly what type of extension you are using in vs code , please make a video on that too. Awesome work👍
Which type of extension, rest client?
@@mafiacodes no , the one that prints inline output in vs code as a comment , and rest of all extensions also...👍
I cannot get which inline output
@@mafiacodes beside of required statement like 5.kb used etc..🙏
Import cost
I need one help in redis i write one client.get middle to get all values but how to make dynamic so that in all routes its work
But if I want cache data like more than in 5sec
amazing!
Thank you.
can someone please explain why some people use hmset() to store a java object?
sir, which font do you use on editor? pl suggest
...
Operator mono
Can you please share Theme you are using along with Fonts Family name?
Snazzy operator theme, operator mono font
Bro please make video on proguard..
I have one question ..what if we have database and web server both on same machine.will it be useful to use redis cache or we can make direct call because server and database are on same machine?
Still useful, since redis is in-memory so reading from memory is way faster than reading from disk.
make a video on hiding api key with rate limiting using node js
Example with django please
maybe sometime later
How implement radis db server over the web. Like in other server. We are going to call it node.js?
Redis db can be installed on any Linux os
@@mafiacodes I am asking about hosting provider online. Where I will host my server. How to do that? And this can be installed ina ny windows system?
Windows not advisable for redis, you can host on aws or digital ocean on run a docker image on zeet
How can we display cached data from redis into html , res.render() ? Since we have the data stringified before to save it.
Thanks.
If ur doing server side rendering, then u shud use a templating engine like “EJS”, you can watch this video to see how ejs works ruclips.net/video/BXuR6ucscJk/видео.html though it’s a video to create short links but ejs part remains the same.
@@mafiacodes Actually my questions was incorrect, it was about caching the html itself and rendering cached html rather than data(json). Wanted to implement this:
res.render('showList',{shows:data},async(err,html)=>{
await client.setAsync('movieList',html);
res.send(html);
Thank you.
I watched the ejs video too.
So ur doubts cleared?
@@mafiacodes yes, thanks
Gr8, feel free for any queries n doubts...
I'm getting this error
(node:11248) UnhandledPromiseRejectionWarning: Error: The client is closed
Can anyone help me?
Just add a line of code `client.connect()` below the `const client = ....`
newer redis client 1) returns promises 2) requires explicit open call
Yes I know 🙂
noice
That's so wrong intro. Use caching when data is fetched often. Not when data doesn't change often
A cache's primary purpose is to increase data retrieval performance by reducing the need to access the underlying slower storage layer.
In a messaging app or notifications - data is fetched quickly, so should you cache - NO.
misleading kids ...this is simple backlink to api....stupid routing...not a single page in real time show..forget this restclı..is macbook cach localshit has no reflection to real server to customer location...blender ..in general what common it guys shows ytb views generating ...sorry nogo
return Promise.reject(new errors_1.ClientClosedError());
^
ClientClosedError: The client is closed
at Commander._RedisClient_sendCommand (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\@redis\client\dist\lib\client\index.js:490:31)
at Commander.commandsExecutor (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\@redis\client\dist\lib\client\index.js:188:154)
at BaseClass. [as get] (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\@redis\client\dist\lib\commander.js:8:29)
at node:internal/util:364:7
at new Promise ()
at Commander. (node:internal/util:350:12)
at C:\MY WORKS\NODE\Node Small Projects\Node-caching\index.js:19:25
at Layer.handle [as handle_request] (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\express\lib
outer\layer.js:95:5)
at next (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\express\lib
outer
oute.js:144:13)
at Route.dispatch (C:\MY WORKS\NODE\Node Small Projects\Node-caching
ode_modules\express\lib
outer
oute.js:114:3)
Node.js v18.12.1
This error is occurring when running your code, please advice