Module: MeRedis::ZipValues::FutureUnzip

Defined in:
lib/me_redis/zip_values.rb

Constant Summary collapse

COMMANDS =

patch futures we need only when we are returning values, usual setters returns OK

%i[incr incrby hincrby get hget getset mget hgetall].map{ |cmd| [cmd, true]}.to_h

Instance Method Summary collapse

Instance Method Details

#set_transformation(&block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/me_redis/zip_values.rb', line 6

def set_transformation(&block)
  return if @transformation_set
  @transformation_set = true

  @old_transformation = @transformation
  @transformation = -> (vl) {
    if @old_transformation
      @old_transformation.call(block.call(vl, self))
    else
      block.call(vl, self)
    end
  }
  self
end