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:
parent
8be37193ee
commit
b0ea6764e0
12 changed files with 121 additions and 19 deletions
10
spec/jobs/dashboard_stats_spec.rb
Normal file
10
spec/jobs/dashboard_stats_spec.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue