Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

Commit

Permalink
Fixing broken cache cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinprince committed Jul 5, 2012
1 parent a067bdd commit 318b770
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/tasks/jobs.rake
Expand Up @@ -15,13 +15,13 @@ namespace :jobs do
#Scheduled clearing down of caches
def clear_caches
timeslot_now = Timeslot.on_now.id
prev_timeslot_now = REDIS.get("current_timeslot").to_i
prev_timeslot_now = $redis.get("current_timeslot").to_i

if timeslot_now != prev_timeslot_now
#clear the timeslot caches and move the current timeslot
invalidate_cache("views/timeslot_#{timeslot_now}*")
invalidate_cache("views/timeslot_#{prev_timeslot_now}*")
REDIS.set("current_timeslot", timeslot_now)
$redis.set("current_timeslot", timeslot_now)

#clear the slot caches for the timeslots
Timeslot.on_now.prev.slots.each do |slot| invalidate_cache("views/slot_#{slot.id}*") end
Expand All @@ -34,8 +34,8 @@ namespace :jobs do
private

def invalidate_cache(cache_key)
REDIS.keys(cache_key).each do |key|
REDIS.del(key)
$redis.keys(cache_key).each do |key|
$redis.del(key)
end
end

Expand Down

0 comments on commit 318b770

Please sign in to comment.