Class: SolidOps::CacheEntriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/solid_ops/cache_entries_controller.rb

Instance Method Summary collapse

Instance Method Details

#clear_allObject



29
30
31
32
33
34
35
36
# File 'app/controllers/solid_ops/cache_entries_controller.rb', line 29

def clear_all
  count = SolidCache::Entry.count
  loop do
    deleted = SolidCache::Entry.limit(1_000).delete_all
    break if deleted.zero?
  end
  redirect_to cache_entries_path, notice: "#{count} cache entries cleared."
end

#destroyObject



22
23
24
25
26
27
# File 'app/controllers/solid_ops/cache_entries_controller.rb', line 22

def destroy
  entry = SolidCache::Entry.find(params[:id])
  key = entry.key
  entry.destroy
  redirect_to cache_entries_path, notice: "Cache key '#{key}' deleted."
end

#indexObject



7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/solid_ops/cache_entries_controller.rb', line 7

def index
  @total_entries = SolidCache::Entry.count
  @total_bytes = begin
    SolidCache::Entry.sum(:byte_size)
  rescue ActiveRecord::StatementInvalid
    nil
  end

  @entries = paginate(SolidCache::Entry.order(created_at: :desc))
end

#showObject



18
19
20
# File 'app/controllers/solid_ops/cache_entries_controller.rb', line 18

def show
  @entry = SolidCache::Entry.find(params[:id])
end