Class: Redisabel::KeyHash

Inherits:
KeyValue show all
Includes:
HashFunctions
Defined in:
lib/redisabel/key_hash.rb

Instance Attribute Summary

Attributes inherited from KeyValue

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HashFunctions

#[], #delete, #store, #to_ary, #to_h, #to_hash, #update_data

Methods inherited from KeyValue

#==, #autosave=, #autosave?, database_key_name, #destroy, #empty?, #eql?, #initialize, #inspect, #load, #to_s, #value, #value=

Methods included from Transformations

detect_type, transform, transform_hash, transform_list, transform_set, transform_string, transform_zset

Methods included from Finders

#filter, #find

Constructor Details

This class inherits a constructor from Redisabel::KeyValue

Class Method Details

.data_typeObject



6
7
8
# File 'lib/redisabel/key_hash.rb', line 6

def self.data_type
  return Hash
end

.redis_delete_methodObject



14
15
16
# File 'lib/redisabel/key_hash.rb', line 14

def self.redis_delete_method
  return :hdel
end

.redis_store_methodObject



10
11
12
# File 'lib/redisabel/key_hash.rb', line 10

def self.redis_store_method
  return :hset
end

Instance Method Details

#saveObject



18
19
20
21
22
23
# File 'lib/redisabel/key_hash.rb', line 18

def save
  return super do |key|
    key_values = @data.to_a.flatten
    next Database.db.hmset(key, *key_values) == Database::ok
  end
end