Sha256: 2116b41ee55a4f3554e6a92f480d18048eeac73286ea5472788017731fed44e2

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

require_relative 'cache'

class CacheBuilder

  def initialize(cache)
    @cache = cache.new
  end

  def self.with(cache)
    return self.new(cache)
  end

  def set_store(path)
    @cache.store = path
    return self
  end

  def set_expiry(time)
    @cache.expiry_time = time
    return self
  end

  def set_refresh(proc)
    @cache.refresh = proc
    return self
  end

  def set_max(max_size)
    @cache.max_size = max_size
    return self
  end

  def build
    @cache.create_store
    return @cache.dup
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libcache-0.2.1 lib/libcache/cache_builder.rb
libcache-0.2.0 lib/libcache/cache_builder.rb