Module: CacheLib
- Defined in:
- lib/cache_lib.rb,
lib/cache_lib/version.rb,
lib/cache_lib/lru_cache.rb,
lib/cache_lib/safe_sync.rb,
lib/cache_lib/ttl_cache.rb,
lib/cache_lib/util_hash.rb,
lib/cache_lib/fifo_cache.rb,
lib/cache_lib/lirs_cache.rb,
lib/cache_lib/basic_cache.rb,
lib/cache_lib/safe_lru_cache.rb,
lib/cache_lib/safe_ttl_cache.rb,
lib/cache_lib/safe_fifo_cache.rb,
lib/cache_lib/safe_lirs_cache.rb,
lib/cache_lib/safe_basic_cache.rb
Defined Under Namespace
Modules: SafeSync
Classes: BasicCache, FifoCache, LirsCache, LruCache, SafeBasicCache, SafeFifoCache, SafeLirsCache, SafeLruCache, SafeTtlCache, TtlCache, UtilHash
Constant Summary
collapse
- VERSION =
'0.1.0'
Class Method Summary
collapse
Class Method Details
.create(type, *args) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/cache_lib.rb', line 15
def self.create(type, *args)
case type
when :basic then BasicCache.new(*args)
when :fifo then FifoCache.new(*args)
when :lru then LruCache.new(*args)
when :ttl then TtlCache.new(*args)
when :lirs then LirsCache.new(*args)
else fail ArgumentError "Cache type not recognized: #{type}"
end
end
|
.safe_create(type, *args) ⇒ Object