forked from OpenNeo/impress
263670a013
In the interest of clearing out Resque, I'm just gonna remove a lot of our more complex caching stuff, and we can do a perf pass for things like big item list pages once everything's upgraded. (I'm hopeful that the upgrades themselves improve perf; and if not, that some improved sensibilities 10 years later can find simpler approaches.)
24 lines
No EOL
523 B
Ruby
24 lines
No EOL
523 B
Ruby
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_fragment_in_all_locales("items/#{item.id} header")
|
|
expire_fragment_in_all_locales("items/#{item.id} info")
|
|
expire_key_in_all_locales("items/#{item.id}#as_json")
|
|
end
|
|
end
|
|
end |