Type:
Module

Fragment caching is used for caching various blocks within views without caching the entire action as a whole. This is useful when certain elements of an action change frequently or depend on complicated state while other parts rarely change or can be shared amongst multiple parties. The caching is done using the cache helper available in the Action View. See ActionView::Helpers::CacheHelper for more information.

While it's strongly recommended that you use key-based cache expiration (see links in CacheHelper for more information), it is also possible to manually expire caches. For example:

expire_fragment('name_of_cache')
write_fragment

write_fragment(key, content, options = nil) Instance Public methods Writes

2015-06-20 00:00:00
read_fragment

read_fragment(key, options = nil) Instance Public methods Reads a cached fragment

2015-06-20 00:00:00
fragment_cache_key

fragment_cache_key(key) Instance Public methods Given a key (as described in

2015-06-20 00:00:00
expire_fragment

expire_fragment(key, options = nil) Instance Public methods Removes fragments

2015-06-20 00:00:00
fragment_exist?

fragment_exist?(key, options = nil) Instance Public methods Check if a cached

2015-06-20 00:00:00