Class: ApiBlueprint::Cache
- Inherits:
-
Object
- Object
- ApiBlueprint::Cache
- Extended by:
- Dry::Configurable, Dry::Initializer
- Defined in:
- lib/api-blueprint/cache.rb
Instance Method Summary collapse
- #exist?(id) ⇒ Boolean
- #generate_cache_key(klass, options) ⇒ Object
- #read(id) ⇒ Object
- #write(id, data, options) ⇒ Object
Instance Method Details
#exist?(id) ⇒ 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 30 31 32 33 34 |
# File 'lib/api-blueprint/cache.rb', line 22 def generate_cache_key(klass, ) if klass&.cache_key_generator&.present? klass.cache_key_generator.call key, else if .is_a? Hash = .clone.with_indifferent_access.except :body [:headers] = [:headers].except *self.class.config.ignored_headers if [:headers] end = Digest::MD5.hexdigest Marshal::dump(.to_s.chars.sort.join) "#{key}:#{klass&.name}:#{}" end 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, ) data end |