Cache power
This commit is contained in:
@@ -18,6 +18,7 @@ class Artist < ActiveRecord::Base
|
||||
self.status = 0
|
||||
save!
|
||||
Delayed::Job.enqueue(LoadArtistJob.new(name))
|
||||
clear_cache
|
||||
end
|
||||
|
||||
def serialize
|
||||
@@ -31,6 +32,10 @@ class Artist < ActiveRecord::Base
|
||||
artist_links: artist_links.map(&:serialize)
|
||||
}
|
||||
end
|
||||
|
||||
def clear_cache
|
||||
Rails.cache.delete "artist_#{id}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
Reference in New Issue
Block a user