django-cacheops icon indicating copy to clipboard operation
django-cacheops copied to clipboard

fix: add Dragonfly compatibility for Lua scripts

Open vyavdoshenko opened this issue 1 month ago • 0 comments

Adds compatibility with Dragonfly - a Redis-compatible in-memory store.

Problem: Undeclared keys in Lua scripts

Dragonfly requires all keys accessed in Lua scripts to be declared upfront in the KEYS array, or the script must explicitly opt out using the --!df flags=allow-undeclared-keys directive.

Cacheops dynamically generates conjunction keys (conj:*) inside Lua scripts, which causes failures in Dragonfly without this flag.

Related Dragonfly issues:

  • https://github.com/dragonflydb/dragonfly/issues/272
  • https://github.com/dragonflydb/dragonfly/issues/6119
  • https://github.com/dragonflydb/dragonfly/pull/6129

Solution:

Added --!df flags=allow-undeclared-keys directive to all Lua scripts. This directive is a Lua comment, so it's safely ignored by Redis.

Tested with Redis 4.x and Redis 7.x - all tests pass.

vyavdoshenko avatar Nov 28 '25 14:11 vyavdoshenko