Hacker News new | ask | show | jobs
by neomantra 631 days ago
When Redis introduced Modules, I liked to turn Redis into a mini-application server akin to what OP discussed with SQL. The article lays out the pros/cons of this pretty well. [I sorta did it with Redis Lua scripts too, but I preferred modules.]

I would create a new Redis command that would do some computation on the input and then store results in appropriate Redis types. One can also use a plethora of C libraries as well. Just don’t block the thread. One could then disable other Redis commands and turn Redis from a bag of data structures into a domain-specific Application Server. The power of this is that it makes the internal processing always consistent, and the version of the application logic is tied to the Module. Plus you can tune it like you tune Redis (for example with respect to persistence).

For HTTP interfacing, I’d either make specific Redis commands for a web service to use or give the web service authority to have direct access to Redis keys (traditional Redis architecture). Often I’d use OpenResty or Golang for that.

I haven’t done this for a while, nor played with Valkey, but it was fun.