Remove as_json item caching
Again I'm just not convinced of the perf on this, and it enables us to delete some whole infra over it, we can improve it another time if it's useful to!
This commit is contained in:
parent
ffa73b6b03
commit
db74dd1e29
3 changed files with 1 additions and 29 deletions
|
@ -37,9 +37,8 @@ class ItemsController < ApplicationController
|
|||
end
|
||||
end
|
||||
elsif params.has_key?(:ids) && params[:ids].is_a?(Array)
|
||||
@items = Item.build_proxies(params[:ids])
|
||||
@items = Item.find(params[:ids])
|
||||
assign_closeted!
|
||||
@items.prepare_method(:as_json)
|
||||
respond_to do |format|
|
||||
format.json { render json: @items }
|
||||
end
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
class Item
|
||||
class UpdateTask
|
||||
extend FragmentExpiration
|
||||
|
||||
TIMEOUT_IN_SECONDS = 10
|
||||
|
||||
@queue = :item_update
|
||||
|
||||
def self.perform(id)
|
||||
Timeout::timeout(TIMEOUT_IN_SECONDS) do
|
||||
item = Item.find(id)
|
||||
expire_cache_for(item)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.expire_cache_for(item)
|
||||
expire_key_in_all_locales("items/#{item.id}#as_json")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,11 +2,6 @@ class ItemObserver < ActionController::Caching::Sweeper
|
|||
def after_create(item)
|
||||
Resque.enqueue(Item::CreateTask, item.id)
|
||||
end
|
||||
|
||||
def after_update(item)
|
||||
# CONSIDER: can pass item.changes.keys in to choose which caches to expire
|
||||
Resque.enqueue(Item::UpdateTask, item.id)
|
||||
end
|
||||
|
||||
def after_destroy(item)
|
||||
Resque.enqueue(Item::DestroyTask, item.id)
|
||||
|
|
Loading…
Reference in a new issue