expire name cache after 1 hour

This commit is contained in:
albert
2011-12-22 12:47:13 -05:00
parent 7aca7f3e2f
commit 5d71f005b0
3 changed files with 5 additions and 3 deletions

View File

@@ -79,7 +79,7 @@ class User < ActiveRecord::Base
end
def id_to_name(user_id)
Cache.get("uin:#{user_id}") do
Cache.get("uin:#{user_id}", 1.hour) do
select_value_sql("SELECT name FROM users WHERE id = ?", user_id) || Danbooru.config.default_guest_name
end
end
@@ -107,6 +107,8 @@ class User < ActiveRecord::Base
Net::HTTP.delete(URI.parse("http://#{server}/users/#{id}/cache"))
end
end
rescue Exception
# swallow, since it'll be expired eventually anyway
end
def validate_feedback_on_name_change