Skip to content

Commit

Permalink
Remove manual expiring of caches
Browse files Browse the repository at this point in the history
All of the removed caches are using the model's cache key.
Because of that they get invalidated whenever the model gets
updated (the updated_at timestamp changes).
  • Loading branch information
bgeuken committed May 22, 2019
1 parent db1ed77 commit 3e16bfd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
6 changes: 0 additions & 6 deletions src/api/app/models/binary_release.rb
Expand Up @@ -12,8 +12,6 @@ class SaveError < APIError; end

#### Callbacks macros: before_save, after_save, etc.
before_create :set_release_time
after_rollback :reset_cache
after_save :reset_cache

#### Scopes (first the default_scope macro if is used)

Expand Down Expand Up @@ -211,10 +209,6 @@ def to_axml(_opts = {})
Rails.cache.fetch("xml_binary_release_#{cache_key}") { render_xml }
end

def reset_cache
Rails.cache.delete("xml_binary_release_#{cache_key}")
end

def identical_to?(binary_hash)
# handle nil/NULL case
buildtime = binary_hash['buildtime'].blank? ? nil : Time.strptime(binary_hash['buildtime'].to_s, '%s')
Expand Down
13 changes: 0 additions & 13 deletions src/api/app/models/bs_request.rb
Expand Up @@ -361,16 +361,6 @@ def state
self[:state].to_sym
end

after_rollback :reset_cache
after_save :reset_cache

def reset_cache
return unless id
Rails.cache.delete("xml_bs_request_fullhistory_#{cache_key}")
Rails.cache.delete("xml_bs_request_history_#{cache_key}")
Rails.cache.delete("xml_bs_request_#{cache_key}")
end

def to_axml(opts = {})
if opts[:withfullhistory]
Rails.cache.fetch("xml_bs_request_fullhistory_#{cache_key}") do
Expand Down Expand Up @@ -683,7 +673,6 @@ def approval_handling(new_approver, opts)

self.approver = new_approver
save!
reset_cache
end
private :approval_handling

Expand Down Expand Up @@ -819,7 +808,6 @@ def setpriority(opts)

self.priority = opts[:priority]
save!
reset_cache

HistoryElement::RequestPriorityChange.create(p)
end
Expand Down Expand Up @@ -939,7 +927,6 @@ def set_accept_at!(time = nil)

self.accept_at = time || Time.now
save!
reset_cache
end

def apply_default_reviewers
Expand Down

0 comments on commit 3e16bfd

Please sign in to comment.