Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.data.redis.core.script
Class DefaultRedisScript<T>

    java.lang.Object
      org.springframework.data.redis.core.script.DefaultRedisScript<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 Implemented Interfaces:
  InitializingBean, RedisScript<T>

    public class DefaultRedisScript<T>

extends Object
implements RedisScript<T>, InitializingBean

Default implementation of `RedisScript`. Delegates to an underlying `ScriptSource` to retrieve script text and detect if script has been modified (and thus should have SHA1 re-calculated). This class is best used as a Singleton to avoid re-calculation of SHA1 on every script execution.

Constructor Summary
`DefaultRedisScript()`

Method Summary
`void` | `afterPropertiesSet()`
`Class<T>` | `getResultType()`
`String` | `getScriptAsString()`
`String` | `getSha1()`
`void` | `setLocation(Resource scriptLocation)`
`void` | `setResultType(Class<T> resultType)`
`void` | `setScriptSource(ScriptSource scriptSource)`
`void` | `setScriptText(String scriptText)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultRedisScript

    public DefaultRedisScript()

Method Detail

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`
  Throws:
    `Exception`

### getSha1

    public String getSha1()

  Specified by:
    `getSha1` in interface `RedisScript<T>`
  Returns:
    The SHA1 of the script, used for executing Redis evalsha command

### getResultType

    public Class<T> getResultType()

  Specified by:
    `getResultType` in interface `RedisScript<T>`
  Returns:
    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")

### getScriptAsString

    public String getScriptAsString()

  Specified by:
    `getScriptAsString` in interface `RedisScript<T>`
  Returns:
    The script contents

### setResultType

    public void setResultType(Class<T> resultType)

  Parameters:
    `resultType` - 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")

### setScriptText

    public void setScriptText(String scriptText)

  Parameters:
    `script` - The script text

### setLocation

    public void setLocation(Resource scriptLocation)

  Parameters:
    `scriptLocation` - The location of the script

### setScriptSource

    public void setScriptSource(ScriptSource scriptSource)

  Parameters:
    `scriptSource` - A @{link `ScriptSource` pointing to the script

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD