Class: ApiBlueprint::Cache

Inherits:
Object
  • Object
show all
Extended by:
Dry::Configurable, Dry::Initializer
Defined in:
lib/api-blueprint/cache.rb

Instance Method Summary collapse

Instance Method Details

#exist?(id) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/api-blueprint/cache.rb', line 10

def exist?(id)
  false
end

#generate_cache_key(klass, options) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/api-blueprint/cache.rb', line 22

def generate_cache_key(klass, options)
  if options.is_a? Hash
    options = options.clone.with_indifferent_access.except *self.class.config.ignored_headers
  end

  options_digest = Digest::MD5.hexdigest Marshal::dump(options.to_s.chars.sort.join)
  "#{key}:#{klass&.name}:#{options_digest}"
end

#read(id) ⇒ Object



14
15
16
# File 'lib/api-blueprint/cache.rb', line 14

def read(id)
  false
end

#write(id, data, options) ⇒ Object



18
19
20
# File 'lib/api-blueprint/cache.rb', line 18

def write(id, data, options)
  data
end