Package me.ahoo.cosid.store.redis
Interface RedisScripts
- All Known Implementing Classes:
LettuceRedisScripts
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The minimal way the Redis store talks to Redis (06-stores.md §2.2, D6): run a Lua script.
LettuceRedisScripts
implements it on Lettuce; the Spring Data adapter of spring/autoconfigure implements it on a
RedisTemplate. Every key of one call shares a hash tag, so the call routes to one Redis Cluster node.
An implementation must not return before the write of the script is acknowledged as far as the
deployment requires (06 §2.2): with replicas, the store relies on it to run WAIT after the script on the same
connection and to fail the call when the replicas do not acknowledge in time.
-
Method Summary
-
Method Details
-
eval
Runs a script, by its SHA-1 digest when Redis has it cached and by its text otherwise (NOSCRIPT).- Parameters:
sha- the lower case hex SHA-1 digest ofscriptscript- the Lua scriptkeys- the keys,KEYSof the scriptargs- the arguments,ARGVof the script- Returns:
- the multi-bulk reply of the script; bulk strings as
String, integers asLong - Throws:
RedisStoreException- if Redis fails, times out or does not acknowledge the write
-