lua-resty-redis icon indicating copy to clipboard operation
lua-resty-redis copied to clipboard

Async save to remote redis instances

Open sdmrnv opened this issue 9 years ago • 2 comments

Hello!

I have installed ngx-lua and lua-redis modules on my Linux-server. So the new site's data saved into local Redis DB via Lua code at location section of my nginx. (As I understand in non-blocking mode for other www-clients of my site). But I have some other remote Redis-servers. And I want to save the same data not only into local Redis, but to these remote Redis instances. As I understand if I do that in one Lua-code (local save+remote saves) the www-user need to wait until all save operations have be done. But I want realize remote savings as asynchronous operations. In this case www-user need to wait only local saving to local Redis. Is there any methods in lua-resty API to realize async execution of some lua-code?

sdmrnv avatar Apr 28 '16 10:04 sdmrnv

please read ngx-lua-module documentation for ngx.timer.at for example this is one way to do it

bjoe2k4 avatar Apr 28 '16 10:04 bjoe2k4

@bjoe2k4: Good idea! Thank you!

sdmrnv avatar Apr 28 '16 16:04 sdmrnv