Class: Jekyll::Cache::FileStore

Inherits:
ActiveSupport::Cache::FileStore
  • Object
show all
Defined in:
lib/jekyll/cache/file_store.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ <EnvyGeeks::Cache>

– Overrides the default method so that we can simply

pass in the name of the directory we want to store
cache files inside of



29
30
31
32
# File 'lib/jekyll/cache/file_store.rb', line 29

def initialize(dir)
  super(Jekyll.cache_dir.join(dir))
  self.logger = Cache.logger
end

Class Method Details

.clearObject



13
14
15
# File 'lib/jekyll/cache/file_store.rb', line 13

def self.clear
  Cache.method(:clear).call
end

Instance Method Details

#fetch(key, **opts) ⇒ <Any>

– Overrides fetch so that we can automatically

(immediately) expire if we are in development, without
the need for any one class to carry expirey data.



41
42
43
44
45
46
47
# File 'lib/jekyll/cache/file_store.rb', line 41

def fetch(key, **opts)
  opts[:expires_in] = expires_in unless opts.key?(:expires_in)
  return yield if opts[:expires_in] == 0.minutes
  super(key, **opts) do
    yield
  end
end

#middlewareObject



18
19
20
# File 'lib/jekyll/cache/file_store.rb', line 18

def middleware
  nil
end