Method: Kiosk::Cacheable::Resource::ClassMethods#expire_resource

Defined in:
lib/kiosk/cacheable/resource.rb

#expire_resource(resource) ⇒ Object

Expire from the cache the resource identified by both the slug and id. Notify any observers of expiration.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/kiosk/cacheable/resource.rb', line 66

def expire_resource(resource)
  notify_observers(:before_expire, resource)

  expire(resource.id)
  expire_by_slug(resource.slug)

  begin
    all_connection_keys_to_expire.each { |key| connection.cache_expire_by_pattern(key) }
  rescue NotImplementedError
  end

  notify_observers(:after_expire, resource)
end