Class: ConvenientService::Support::Cache::Entities::Caches::Hash
- Inherits:
-
Base
- Object
- Base
- ConvenientService::Support::Cache::Entities::Caches::Hash
show all
- Defined in:
- lib/convenient_service/support/cache/entities/caches/hash.rb
Instance Method Summary
collapse
Methods inherited from Base
#==, #[], #[]=, #keygen, keygen, #scope
included
Constructor Details
#initialize(hash = {}) ⇒ void
12
13
14
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 12
def initialize(hash = {})
@hash = hash
end
|
Instance Method Details
95
96
97
98
99
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 95
def clear
hash.clear
self
end
|
#delete(key) ⇒ Object
88
89
90
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 88
def delete(key)
hash.delete(key)
end
|
#empty? ⇒ Boolean
29
30
31
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 29
def empty?
hash.empty?
end
|
#exist?(key) ⇒ Boolean
40
41
42
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 40
def exist?(key)
hash.has_key?(key)
end
|
#fetch(key, &block) ⇒ Object
75
76
77
78
79
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 75
def fetch(key, &block)
return hash[key] unless block
hash.fetch(key) { hash[key] = yield }
end
|
#read(key) ⇒ Object
51
52
53
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 51
def read(key)
hash[key]
end
|
#store ⇒ Hash{Object => Object}
19
20
21
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 19
def store
hash
end
|
#write(key, value) ⇒ Object
63
64
65
|
# File 'lib/convenient_service/support/cache/entities/caches/hash.rb', line 63
def write(key, value)
hash[key] = value
end
|