Class: RailsWebCache::Base
- Inherits:
-
Object
- Object
- RailsWebCache::Base
show all
- Defined in:
- lib/rails_web_cache/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(cache) ⇒ Base
Returns a new instance of Base.
7
8
9
|
# File 'lib/rails_web_cache/base.rb', line 7
def initialize(cache)
@cache = cache
end
|
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
5
6
7
|
# File 'lib/rails_web_cache/base.rb', line 5
def cache
@cache
end
|
Instance Method Details
#clear ⇒ Object
15
16
17
|
# File 'lib/rails_web_cache/base.rb', line 15
def clear
cache.clear
end
|
#delete(key) ⇒ Object
23
24
25
|
# File 'lib/rails_web_cache/base.rb', line 23
def delete(key)
cache.delete(key) if key
end
|
#entry(key, options = {}) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/rails_web_cache/base.rb', line 27
def entry(key, options = {})
return unless key
entry = read_entry(key, options)
return unless entry
RailsWebCache::Entry.new(entry)
end
|
#keys_size ⇒ Object
11
12
13
|
# File 'lib/rails_web_cache/base.rb', line 11
def keys_size
keys.size
end
|
#read(key) ⇒ Object
19
20
21
|
# File 'lib/rails_web_cache/base.rb', line 19
def read(key)
cache.read(key) if key
end
|
#search(query = '') ⇒ Object
34
35
36
|
# File 'lib/rails_web_cache/base.rb', line 34
def search(query = '')
keys.select { |key| key.downcase.include?(query.downcase) } if query
end
|