class Jekyll::Cache::FileStore
Public Class Methods
clear()
click to toggle source
# File lib/jekyll/cache/file_store.rb, line 13 def self.clear Cache.method(:clear).call end
new(dir)
click to toggle source
– @return [<EnvyGeeks::Cache>] the 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
@see goo.gl/3G35gw –
Calls superclass method
# File lib/jekyll/cache/file_store.rb, line 29 def initialize(dir) super(Jekyll.cache_dir.join(dir)) self.logger = Cache.logger end
Public Instance Methods
fetch(key, **opts) { || ... }
click to toggle source
– @param key [String,Symbol] the cache key. 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.
@return [<Any>] the cached value. –
Calls superclass method
# 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
middleware()
click to toggle source
–
# File lib/jekyll/cache/file_store.rb, line 18 def middleware nil end
Private Instance Methods
expires_in()
click to toggle source
– @return [ActiveSupport::Duration] the time. Tells you how long until we plan to expire something
In production this is always set to 0 minutes, in dev it's set to around 6 minutes, this way your sites don't build slow when you are working.
–
# File lib/jekyll/cache/file_store.rb, line 57 def expires_in (Jekyll.env == "development" ? 24 : 0).minutes end