Module: Cloudinary::Cache

Defined in:
lib/cloudinary/cache.rb,
lib/cloudinary/cache/breakpoints_cache.rb,
lib/cloudinary/cache/rails_cache_adapter.rb,
lib/cloudinary/cache/key_value_cache_adapter.rb

Defined Under Namespace

Modules: Storage Classes: BreakpointsCache, KeyValueCacheAdapter, RailsCacheAdapter

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storageObject

Returns the value of attribute storage.



7
8
9
# File 'lib/cloudinary/cache.rb', line 7

def storage
  @storage
end

Class Method Details

.flush_allObject



23
24
25
# File 'lib/cloudinary/cache.rb', line 23

def flush_all
  storage.clear
end

.get(public_id, options) ⇒ Object Also known as: fetch



9
10
11
12
13
14
15
# File 'lib/cloudinary/cache.rb', line 9

def get(public_id, options)
  if block_given?
    storage.read(generate_cache_key(public_id, options)) {yield}
  else
    storage.read(generate_cache_key(public_id, options))
  end
end

.set(public_id, options, value) ⇒ Object



17
18
19
# File 'lib/cloudinary/cache.rb', line 17

def set(public_id, options, value)
  storage.write(generate_cache_key(public_id, options), value)
end