Posts

Showing posts with the label redis

how to wait till the response is received from redis in node?

how to wait till the response is received from redis in node? I am new to node and redis.I am using redis in my node application.I want to retreive data from redis in a synchronous fashion.Here is what I tried. var redis = require("redis"), client = redis.createClient(); client.set('key',10,redis.print); function getfn1(key){ client.get(key,function(err,reply){ if(err){ console.log('Response from getfn1:-'); console.log(err); return; } console.log('Response from getfn1:-'); console.log(reply); }); } async function getfn2(key){ let response = await client.get(key); console.log('Response from getfn2:-'); console.log(response); } console.log('1'); getfn1('key'); console.log('2'); getfn2('key'); console.log('3'); The result is as follows: 1 2 3 Response from getfn2:- false Response from getfn1:- 10 As you can see I am tryi...

Does Redis allow overlapped bgsave operations targeting same RDB file?

Does Redis allow overlapped bgsave operations targeting same RDB file? For an example, a Redis client triggers second bgsave before first bgsave is completed, resulting in overlapped bgsave operations. Both bgsave operations target the same RDB file. You can easily test this, and you'll find the the 2nd bgsave is ignored. – Itamar Haber 2 days ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.