Class: Fastentry::CacheController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fastentry/cache_controller.rb

Instance Method Summary collapse

Instance Method Details

#invalidateObject



10
11
12
13
14
15
# File 'app/controllers/fastentry/cache_controller.rb', line 10

def invalidate
  key = params[:key]
  Rails.cache.delete(key)

  redirect_back(fallback_location: root_path)
end

#showObject



3
4
5
6
7
8
# File 'app/controllers/fastentry/cache_controller.rb', line 3

def show
  @key = params[:key]
  expiration_date = Rails.cache.send(:read_entry, @key, {}).expires_at
  @expiration = (Time.at(expiration_date).strftime("%a, %e %b %Y %H:%M:%S %z") if expiration_date.present?)
  @cache_item = Rails.cache.read(@key)
end