Sha256: 76c7080d31037afbec5d0eb16299cd228b3c6f1f096749fadb7e2eca4c6bbcaf
Contents?: true
Size: 1.65 KB
Versions: 20
Compression:
Stored size: 1.65 KB
Contents
<!-- Tags for caching --> <!-- `<hobo-cache>` is a simple fragment cache without the hierarchical dependency tracking used in `<swept-cache>` or `<nested-cache>`. ### Attributes All extra attributes are used as cache keys. `query-params`: A comma separated list of query (or post) parameters used as non-hierarchical cache keys. `route-on`: Rails fragment caching uses the the current route to build its cache key. If you are caching an item that will be used in multiple different actions, you can specify route-on to ensure that the different actions can share the cache. You can pass either an object or a path to route-on. If you pass an object, it is converted to a path with `url_for`. If you specify route-on without a value, `this` is used. An alternative to using `route-on` is to specify `controller`, `action` and any other required path parameters explicitly. For example route-on="&posts_path" is identical to controller="posts" action="index". If you do not specify route-on or controller, action, etc., `params[:page_path]` or the current action is used. --> <def tag="hobo-cache" attrs="query-params,route-on"><% unless Rails.configuration.action_controller.perform_caching %><%= parameters.default %><% else key_key_s = hobo_cache_key(:views, route_on, query_params, attributes) cache_content = Rails.cache.read key_key_s unless cache_content.nil? Rails.logger.debug "CACHE HIT #{key_key_s}" %><%= raw cache_content %><% else Rails.logger.debug "CACHE MISS #{key_key_s}" %><%= raw cache_content=parameters.default %><% Rails.cache.write(key_key_s, cache_content) end end %></def>
Version data entries
20 entries across 20 versions & 1 rubygems