Class: Rack::Bug::CachePanel::PanelApp
- Inherits:
-
PanelApp
- Object
- PanelApp
- Rack::Bug::CachePanel::PanelApp
show all
- Defined in:
- lib/rack/bug/panels/cache_panel/panel_app.rb
Instance Attribute Summary
Attributes inherited from PanelApp
#request
Instance Method Summary
collapse
Methods inherited from PanelApp
#call, #not_found, #params, #render_template, #validate_params
Methods included from Render
#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params
Instance Method Details
#delete_cache ⇒ Object
27
28
29
30
31
32
|
# File 'lib/rack/bug/panels/cache_panel/panel_app.rb', line 27
def delete_cache
validate_params
raise "Rails not found... can't delete key" unless defined?(Rails)
Rails.cache.delete(params["key"])
ok
end
|
#delete_cache_list ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/rack/bug/panels/cache_panel/panel_app.rb', line 34
def delete_cache_list
validate_params
raise "Rails not found... can't delete key" unless defined?(Rails)
params.each do |key, value|
next unless key =~ /^keys_/
Rails.cache.delete(value)
end
ok
end
|
#dispatch ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/rack/bug/panels/cache_panel/panel_app.rb', line 9
def dispatch
case request.path_info
when "/__rack_bug__/view_cache" then view_cache
when "/__rack_bug__/delete_cache" then delete_cache
when "/__rack_bug__/delete_cache_list" then delete_cache_list
else not_found
end
end
|
#ok ⇒ Object
18
19
20
|
# File 'lib/rack/bug/panels/cache_panel/panel_app.rb', line 18
def ok
Rack::Response.new(["OK"]).to_a
end
|
#view_cache ⇒ Object
22
23
24
25
|
# File 'lib/rack/bug/panels/cache_panel/panel_app.rb', line 22
def view_cache
validate_params
render_template "panels/view_cache", :key => params["key"], :value => Rails.cache.read(params["key"])
end
|