mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
minor refactor
This commit is contained in:
parent
a69f59ef51
commit
d9df40dfcd
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue