Sha256: 7662d607c5c4808c1ba6c19c816ab8444ce91293f4f8e4e4b1be05e46840f809
Contents?: true
Size: 859 Bytes
Versions: 14
Compression:
Stored size: 859 Bytes
Contents
module JSONAPIonify::Api module Resource::Caching def cache key, **options raise Errors::DoubleCacheError, "Cache was already called for this action" if @cache_called @cache_called = true @cache_options.merge! options # Build the cache key, and obscure it. @__context.meta[:cache_key] = @cache_options[:key] = cache_key( path: @__context.request.path, accept: @__context.request.accept, params: @__context.params, key: key ) # If the cache exists, then fail to cache miss if self.class.cache_store.exist?(@cache_options[:key]) && !@__context.invalidate_cache? raise Errors::CacheHit, @cache_options[:key] end end def cache_key(**options) self.class.cache_key( **options, action_name: action_name ) end end end
Version data entries
14 entries across 14 versions & 1 rubygems