2009-05-09 09:25:59 +02:00
|
|
|
require "redis"
|
|
|
|
|
|
|
|
class Redis
|
|
|
|
class Pipeline < Redis
|
|
|
|
BUFFER_SIZE = 50_000
|
|
|
|
|
|
|
|
def initialize(redis)
|
|
|
|
@redis = redis
|
|
|
|
@commands = []
|
|
|
|
end
|
2009-06-10 00:11:17 +02:00
|
|
|
|
|
|
|
def call_command(command)
|
|
|
|
@commands << command
|
2009-06-10 00:08:10 +02:00
|
|
|
end
|
2009-06-10 00:11:17 +02:00
|
|
|
|
|
|
|
def execute
|
|
|
|
@redis.call_command(@commands)
|
2009-05-09 09:25:59 +02:00
|
|
|
@commands.clear
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-05-26 18:10:50 +02:00
|
|
|
end
|