Class: CacheBuilder
- Inherits:
-
Object
- Object
- CacheBuilder
- Defined in:
- lib/libcache/cache_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(cache) ⇒ CacheBuilder
constructor
A new instance of CacheBuilder.
- #set_expiry(time) ⇒ Object
- #set_refresh(proc) ⇒ Object
- #set_store(path) ⇒ Object
Constructor Details
#initialize(cache) ⇒ CacheBuilder
Returns a new instance of CacheBuilder.
5 6 7 |
# File 'lib/libcache/cache_builder.rb', line 5 def initialize(cache) @cache = cache.new end |
Class Method Details
.with(cache) ⇒ Object
9 10 11 |
# File 'lib/libcache/cache_builder.rb', line 9 def self.with(cache) return self.new(cache) end |
Instance Method Details
#build ⇒ Object
28 29 30 31 |
# File 'lib/libcache/cache_builder.rb', line 28 def build @cache.create_store return @cache.dup end |
#set_expiry(time) ⇒ Object
18 19 20 21 |
# File 'lib/libcache/cache_builder.rb', line 18 def set_expiry(time) @cache.expiry_time = time return self end |
#set_refresh(proc) ⇒ Object
23 24 25 26 |
# File 'lib/libcache/cache_builder.rb', line 23 def set_refresh(proc) @cache.refresh = proc return self end |
#set_store(path) ⇒ Object
13 14 15 16 |
# File 'lib/libcache/cache_builder.rb', line 13 def set_store(path) @cache.store = path return self end |