Module: ContentfulRails::Caching::Timestamps::ClassMethods

Defined in:
lib/contentful_rails/caching/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#clear_cache_for(item_id) ⇒ Object

Clear an existing timestamp from the cache; called by the subscriber to the Entry notifications from the WebhooksController.



18
19
20
21
22
# File 'lib/contentful_rails/caching/timestamps.rb', line 18

def clear_cache_for(item_id)
  cache_key = timestamp_cache_key(item_id)

  Rails.cache.delete(cache_key)
end

#timestamp_cache_key(item_id) ⇒ Object



24
25
26
# File 'lib/contentful_rails/caching/timestamps.rb', line 24

def timestamp_cache_key(item_id)
  "contentful_timestamp/#{self.content_type_id}/#{item_id}"
end