Interface RedisScript<T>

Type Parameters:
T - The script result type. Should be one of Long, Boolean, List, or deserialized value type. Can be null if the script returns a throw-away status (i.e "OK")
All Known Implementing Classes:
DefaultRedisScript

public interface RedisScript<T>
A script to be executed using the Redis scripting support available as of version 2.6
Author:
Jennifer Hickey, Christoph Strobl, Mark Paluch
  • Method Details

    • getSha1

      String getSha1()
      Returns:
      The SHA1 of the script, used for executing Redis evalsha command.
    • getResultType

      @Nullable Class<T> getResultType()
      Returns:
      The script result type. Should be one of Long, Boolean, List, or deserialized value type. null if the script returns a throw-away status (i.e "OK").
    • getScriptAsString

      String getScriptAsString()
      Returns:
      The script contents.
    • returnsRawValue

      default boolean returnsRawValue()
      Returns:
      true if result type is null and does not need any further deserialization.
      Since:
      2.0
    • of

      static <T> RedisScript<T> of(String script)
      Creates new RedisScript from script as String.
      Parameters:
      script - must not be null.
      Returns:
      new instance of RedisScript.
      Since:
      2.0
    • of

      static <T> RedisScript<T> of(String script, Class<T> resultType)
      Creates new RedisScript from script as String.
      Parameters:
      script - must not be null.
      resultType - must not be null.
      Returns:
      new instance of RedisScript.
      Since:
      2.0
    • of

      static <T> RedisScript<T> of(Resource resource)
      Creates new RedisScript (with throw away result) from the given Resource.
      Parameters:
      resource - must not be null.
      Returns:
      new instance of RedisScript.
      Throws:
      IllegalArgumentException - if the required argument is null.
      Since:
      2.2
    • of

      static <T> RedisScript<T> of(Resource resource, Class<T> resultType)
      Creates new RedisScript from Resource.
      Parameters:
      resource - must not be null.
      resultType - must not be null.
      Returns:
      new instance of RedisScript.
      Throws:
      IllegalArgumentException - if any required argument is null.
      Since:
      2.2