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 Shipping::Service.all.to_a end end
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
How'd We Do?
Was this article missing something?
Was it not quite what you were looking for?
Do you have suggestions on how we could improve this article or your experience in general?
If so, please take a moment to let us know!
Your invaluable feedback will help everyone better understand the platform!