Add RedisTemplate methods for executing Redis scripts
DATAREDIS-199
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="lettuceConnectionFactory "
|
||||
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
|
||||
<property name="hostName">
|
||||
<bean class="org.springframework.data.redis.SettingsUtils" factory-method="getHost" />
|
||||
</property>
|
||||
<property name="port">
|
||||
<bean class="org.springframework.data.redis.SettingsUtils" factory-method="getPort" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,7 @@
|
||||
local size=redis.call('LLEN',KEYS[1])
|
||||
local max = math.min(size,ARGV[1])
|
||||
local t={}
|
||||
for variable = 1, max, 1 do
|
||||
table.insert(t,redis.call('RPOP',KEYS[1]))
|
||||
end
|
||||
return t
|
||||
@@ -0,0 +1,7 @@
|
||||
local current = redis.call('GET', KEYS[1])
|
||||
if current == ARGV[1]
|
||||
then
|
||||
redis.call('SET', KEYS[1], ARGV[2])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -0,0 +1,5 @@
|
||||
if redis.call("EXISTS",KEYS[1]) == 1 then
|
||||
return redis.call("INCR",KEYS[1])
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
local t={}
|
||||
table.insert(t,redis.call('RPOP',KEYS[1]))
|
||||
table.insert(t,redis.call('LLEN',KEYS[1]))
|
||||
return t
|
||||
Reference in New Issue
Block a user