class ApiBlueprint::Cache

Public Instance Methods

exist?(id) click to toggle source
# File lib/api-blueprint/cache.rb, line 10
def exist?(id)
  false
end
generate_cache_key(klass, options) click to toggle source
# File lib/api-blueprint/cache.rb, line 22
def generate_cache_key(klass, options)
  if klass&.cache_key_generator&.present?
    klass.cache_key_generator.call key, options
  else
    if options.is_a? Hash
      options = options.clone.with_indifferent_access.except :body
      options[:headers] = options[:headers].except *self.class.config.ignored_headers if options[:headers]
    end

    options_digest = Digest::MD5.hexdigest Marshal::dump(options.to_s.chars.sort.join)
    "#{key}:#{klass&.name}:#{options_digest}"
  end
end
read(id) click to toggle source
# File lib/api-blueprint/cache.rb, line 14
def read(id)
  false
end
write(id, data, options) click to toggle source
# File lib/api-blueprint/cache.rb, line 18
def write(id, data, options)
  data
end