Skip to content

Commit

Permalink
close saberma#388, expires storage cache key in 5 minutes.
Browse files Browse the repository at this point in the history
  • Loading branch information
saberma committed Feb 2, 2012
1 parent 5e53ac8 commit e24b1a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/shop.rb
Expand Up @@ -81,7 +81,7 @@ def plan_unlimited?
end

def storage # 已占用的容量(如要支持windows可修改为循环获取目录大小)
Rails.cache.fetch(self.storage_cache_key) do
Rails.cache.fetch(self.storage_cache_key, expires_in: 5.minutes) do
`du -sm #{self.path} | awk '{print $1}'`.to_i # 以M为单位
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/views/admin/account/_about.html.haml
Expand Up @@ -12,10 +12,10 @@
%span.note{:style => ""}==剩余#{current_plan_type.skus - skus_size}个
%tr#disk-management
%td.r 剩余使用空间:
%td
%div{:style => "width:170px"}
.progress-container{:style => "margin-top:7px"}
.progress-bar{:style => "width: #{storages_size*100/current_plan_type.storage}%; "}
%td(title="数值会被缓存5分钟")
%div(style="width:170px")
.progress-container(style="margin-top:7px")
.progress-bar(style="width: #{storages_size*100/current_plan_type.storage}%; ")
%span.note==剩余#{current_plan_type.storage - storages_size} MB
-#
%tr
Expand Down

0 comments on commit e24b1a9

Please sign in to comment.