Low-Level Caching

Certain slow or frequently running queries or processing are cached from the classes defining them. The Workarea system follows the Rails convention in how this is handled.


def self.cache
  Rails.cache.fetch('shipping_services_cache', expires_in: Workarea.config.cache_expirations.shipping_services) do

The work to be cached is placed inside a call to the Rails.cache. Like the fragment caching in the views, if the cache store does not have a fresh cache, the block is executed and the result is cached.

Resources on Low-Level Caching