minor refactor

This commit is contained in:
Sam 2014-02-06 17:07:15 +11:00
parent a69f59ef51
commit d9df40dfcd

View file

@ -20,11 +20,12 @@ task 'assets:precompile:before' do
digest = Digest::SHA1.hexdigest(data) digest = Digest::SHA1.hexdigest(data)
key = "SPROCKETS_#{digest}" 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) compiled = Uglifier.new(:comments => :none).compile(data)
$redis.setex(key, 1.week, compiled) $redis.setex(key, 1.week, compiled)
end end
$redis.expire(key, 1.week)
compiled compiled
end end
end end