Sha256: 188c5b8785053b554619e4a53ed6a733070c3ebb592213475de4bf137427a246

Contents?: true

Size: 475 Bytes

Versions: 1

Compression:

Stored size: 475 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 build
    @cache.create_store
    return @cache.dup
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libcache-0.1.0 lib/libcache/cache_builder.rb