From d9df40dfcd938ad3938117dd812f949d04ab3fa5 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Feb 2014 17:07:15 +1100 Subject: [PATCH] minor refactor --- lib/tasks/assets.rake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index cca89c7bbd1..a71236ff9e7 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -20,11 +20,12 @@ task 'assets:precompile:before' do digest = Digest::SHA1.hexdigest(data) key = "SPROCKETS_#{digest}" - unless compiled = $redis.get(key) + if compiled = $redis.get(key) + $redis.expire(key, 1.week) + else compiled = Uglifier.new(:comments => :none).compile(data) $redis.setex(key, 1.week, compiled) end - $redis.expire(key, 1.week) compiled end end