Class: Fastentry::CacheController

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

Instance Method Summary collapse

Instance Method Details

#invalidateObject



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

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

  redirect_to root_path
end

#invalidate_multipleObject



19
20
21
22
23
24
25
26
# File 'app/controllers/fastentry/cache_controller.rb', line 19

def invalidate_multiple
  keys = params[:invalidate_cache_keys] || []
  keys.each do |key|
    Fastentry.cache.delete(key)
  end

  redirect_to root_path
end

#showObject



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

def show
  @key = params[:key]

  expiration = Fastentry.cache.expiration_for(@key)
  @expiration = expiration.strftime("%a, %e %b %Y %H:%M:%S %z") if expiration

  @cache_item = Fastentry.cache.read(@key)
end