Module: RedisRing::Client::OperationDefinitions::ClassMethods

Defined in:
lib/redis_ring/client/operation_definitions.rb

Instance Method Summary collapse

Instance Method Details

#mapped_set_operation(name) ⇒ Object



113
114
115
116
117
118
119
120
121
# File 'lib/redis_ring/client/operation_definitions.rb', line 113

def mapped_set_operation(name)
  self.class_eval <<-RUBY

    def #{name}(hash, &block)
      return single_connection_operation(:#{name}, hash.keys, hash, &block)
    end

  RUBY
end

#multi_key_operation(name) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/redis_ring/client/operation_definitions.rb', line 103

def multi_key_operation(name)
  self.class_eval <<-RUBY

    def #{name}(*keys, &block)
      return single_connection_operation(:#{name}, keys, *keys, &block)
    end

  RUBY
end

#multi_zstore_operation(name) ⇒ Object



133
134
135
136
137
138
139
140
141
# File 'lib/redis_ring/client/operation_definitions.rb', line 133

def multi_zstore_operation(name)
  self.class_eval <<-RUBY

    def #{name}(destination, keys, options = {})
      return single_connection_operation(:#{name}, [destination] + keys, destination, keys, options)
    end

  RUBY
end

#random_shard_operation(name) ⇒ Object



93
94
95
96
97
98
99
100
101
# File 'lib/redis_ring/client/operation_definitions.rb', line 93

def random_shard_operation(name)
  self.class_eval <<-RUBY

    def #{name}(*args, &block)
      random_shard_operation(:#{name}, *args, &block)
    end

  RUBY
end

#regular_set_operation(name) ⇒ Object



123
124
125
126
127
128
129
130
131
# File 'lib/redis_ring/client/operation_definitions.rb', line 123

def regular_set_operation(name)
  self.class_eval <<-RUBY

    def #{name}(*keys_and_values, &block)
      return single_connection_operation(:#{name}, Hash[*keys_and_values].keys, *keys_and_values, &block)
    end

  RUBY
end

#scather_gather_operation(name, gather_function) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/redis_ring/client/operation_definitions.rb', line 73

def scather_gather_operation(name, gather_function)
  self.class_eval <<-RUBY

  def #{name}(*args, &block)
    return scather_gather_operation(:#{name}, :#{gather_function}, *args, &block)
  end

  RUBY
end

#single_key_operation(name) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/redis_ring/client/operation_definitions.rb', line 63

def single_key_operation(name)
  self.class_eval <<-RUBY

  def #{name}(key, *args)
    return single_key_operation(:#{name}, key, *args)
  end

  RUBY
end

#unsupported_operation(name) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/redis_ring/client/operation_definitions.rb', line 83

def unsupported_operation(name)
  self.class_eval <<-RUBY

    def #{name}(*args)
      unsupported_operation(:#{name})
    end

  RUBY
end