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.

@FunctionalInterface public interface RedisScripts
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

    Modifier and Type
    Method
    Description
    eval(String sha, String script, List<String> keys, List<String> args)
    Runs a script, by its SHA-1 digest when Redis has it cached and by its text otherwise (NOSCRIPT).
  • Method Details

    • eval

      List<Object> eval(String sha, String script, List<String> keys, List<String> args)
      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 of script
      script - the Lua script
      keys - the keys, KEYS of the script
      args - the arguments, ARGV of the script
      Returns:
      the multi-bulk reply of the script; bulk strings as String, integers as Long
      Throws:
      RedisStoreException - if Redis fails, times out or does not acknowledge the write