Shavaluator wrapper around Redis EVALSHA/EVAL for efficient Lua script execution. Version 1.1.1 is latest (stable). Provides a simple API to pre-register Lua scripts with SHA-1 hashes, automatically falling back from EVALSHA to EVAL if the script is not cached on the Redis server. Avoids recomputing SHA-1 on every call (unlike node-redis's built-in eval). Designed for the node-redis client (mranney/node-redis). Lightweight: zero runtime dependencies. No TypeScript types.
npm install redis-evalshaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize Shavaluator with a Redis client, add a Lua script, and execute it with EVALSHA/EVAL fallback.
Check if the first argument is truthy and handle both strings and Error objects.
Always pass arrays: ['key1'], ['arg1'].
Use only with node-redis (redis npm package version 2.x or 3.x). For ioredis, use its built-in evalsha or another library.
Consider migrating to redis v4 and using its native EVALSHA support, or find an alternative wrapper.
Test your Lua scripts manually before using them in production.
Use node-redis version 2.x or 3.x. For redis v4, consider using its built-in EVALSHA or find another library.
Check your Lua script syntax and ensure it uses 'redis.call('COMMAND', ...)' or 'redis.pcall' correctly.Ensure exec is called with exactly four arguments: scriptName (string), keys (array), args (array), callback (function).
Call shavaluator.add('scriptName', 'luaScriptBody') before attempting to execute it.No dependency data recorded yet.