diff --git a/docs/src/reference/docbook/reference/redis-scripting.xml b/docs/src/reference/docbook/reference/redis-scripting.xml new file mode 100644 index 000000000..5155063b7 --- /dev/null +++ b/docs/src/reference/docbook/reference/redis-scripting.xml @@ -0,0 +1,25 @@ + +
+ Redis Scripting + Redis versions 2.6 and higher provide support for execution of Lua scripts through the eval and + evalsha commands. These operations as well as other script management operations are available on the + RedisConnection implementations. + + + Future SDR versions may offer support for these scripting commands on a higher-level API, such as RedisTemplate. + + Here's an example script execution: + + () { + public Long doInRedis(RedisConnection connection) throws DataAccessException { + return connection.eval("return 10", ReturnType.INTEGER, 0); + } +});]]> + + The return values of eval and evalsha can be assigned to any type. However, they should + match the expected ReturnType passed to these methods. In the above example, we passed ReturnType.Integer, therefore + the return type of eval was a Long. Similarly, using ReturnType.VALUE will yield a byte[]. See the ReturnType javadoc + for details. + +
\ No newline at end of file diff --git a/docs/src/reference/docbook/reference/redis-transactions.xml b/docs/src/reference/docbook/reference/redis-transactions.xml index 4f29e2f9b..b0f381bf3 100644 --- a/docs/src/reference/docbook/reference/redis-transactions.xml +++ b/docs/src/reference/docbook/reference/redis-transactions.xml @@ -10,13 +10,13 @@ as when using Redis transactions. For example: - () { - public Object execute(RedisOperations operations) throws DataAccessException { - operations.multi(); - operations.opsForValue().set("key", "value"); - List results = operations.exec(); - return null; - } + public Object execute(RedisOperations operations) throws DataAccessException { + operations.multi(); + operations.opsForValue().set("key", "value"); + List results = operations.exec(); + return null; + } });]]> \ No newline at end of file diff --git a/docs/src/reference/docbook/reference/redis.xml b/docs/src/reference/docbook/reference/redis.xml index 8d13f14fc..7f005bfb4 100644 --- a/docs/src/reference/docbook/reference/redis.xml +++ b/docs/src/reference/docbook/reference/redis.xml @@ -395,6 +395,8 @@ + +
Support Classes diff --git a/src/main/java/org/springframework/data/redis/connection/ReturnType.java b/src/main/java/org/springframework/data/redis/connection/ReturnType.java index 5dee288bf..1c734d130 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReturnType.java +++ b/src/main/java/org/springframework/data/redis/connection/ReturnType.java @@ -23,5 +23,19 @@ package org.springframework.data.redis.connection; * */ public enum ReturnType { - BOOLEAN, INTEGER, MULTI, STATUS, VALUE + + /** Returned as Boolean **/ + BOOLEAN, + + /** Returned as Long **/ + INTEGER, + + /** Returned as List **/ + MULTI, + + /** Returned as byte[] **/ + STATUS, + + /** Returned as byte[] **/ + VALUE }