Skip to content

Instantly share code, notes, and snippets.

@dphase
Created August 12, 2014 15:48
Show Gist options
  • Save dphase/5efdb22e56d1891a9e00 to your computer and use it in GitHub Desktop.
Save dphase/5efdb22e56d1891a9e00 to your computer and use it in GitHub Desktop.
# Determines whether or not to cache a dataset based on the configuration
# settings of the plugin.
#--
# TODO: Specify a place to find those settings. However, where those are
# applied is currently in flux. Also, further document how this process
# actually works.
#++
def is_cacheable_by_default?
cache_by_default = cache_options[:cache_by_default]
return false unless cache_by_default
return true if cache_by_default[:always]
proc = cache_by_default[:proc] || CACHE_BY_DEFAULT_PROC
proc.call(self, cache_by_default)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment