Class: EditmodeController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/editmode_controller.rb

Instance Method Summary collapse

Instance Method Details

#clear_cacheObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/editmode_controller.rb', line 3

def clear_cache
  if params[:full]
    Rails.cache.clear
    render status: 200, json: {:response => "success"}
  elsif params[:collection]
    cache_id = "collection_#{params[:identifier]}"
    Rails.cache.delete_matched("*#{cache_id}*")
    render status: 200, json: {:response => "success"}
  elsif params[:variable_cache_project_id]
    project_id = params[:variable_cache_project_id]
    Rails.cache.delete("chunk_#{project_id}_variables")
    render status: 200, json: {:response => "success"}
  elsif params[:identifier]
    Rails.cache.delete_matched("*#{params[:identifier]}*")
    render status: 200, json: {:response => "success"}
  else
    render status: 404, json: {:response => "no identifier specified"}
  end

end