redisluabusiness-logicbusiness-logic-layer

Where to place my business logic when using redis as my core BD


Ok, so I want to make a platform based on building feeds of news that I read from RSSs. And I want to ingest data to redis using kafka, and this data in redis will be also used by other services. So I was wondering that I should implement an API to interact to my redis BD so I do not have my business logic sharded between clients doing requests to redis, I have thought of implementing a REST API inside a server which will store the core business logic. BUT, could I use LUA scripting to do so and avoid this extra node in my architecture? I mean: instead of implementing a POST in an API REST that would implement the creation of a Feed in my redis BD, I would implement a lua script to do so. And when I need an outside server to create a Feed I will call directly this lua script. This way I will reduce the round trips needed to make a change in my BD but I don't know if it can be very problematic in any way.


Solution

  • Lua script can't be set as a Rest Server in Redis as it can't get out of the sandbox and can't run the background.

    You might want to check the Redis module RedisGears as it can run Python script and is not limited to the sandbox.

    Another module you might want to check is RedisRest.