2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

PERF: Cache About#stats.

This commit is contained in:
Guo Xiang Tan 2015-07-07 12:52:19 +08:00
parent 8be37193ee
commit b0ea6764e0
12 changed files with 121 additions and 19 deletions

View file

@ -0,0 +1,10 @@
require 'spec_helper'
describe Jobs::DashboardStats do
it 'caches the stats' do
json = { "visited" => 10 }
AdminDashboardData.any_instance.expects(:as_json).returns(json)
$redis.expects(:setex).with(AdminDashboardData.stats_cache_key, 35.minutes, json.to_json)
expect(described_class.new.execute({})).to eq(json)
end
end