feat: expiry for cache keys [CW-3038] (#8793)
* feat: set cache keys for 3 days only * feat: invalidate should set the latest timestamp * refactor: cache_keys concern * remove invalidate_cache method * refactor reset to set to new value instead of delete * ensure only one event is dispatched * feat: set expiry to 24 hours * chore: make expiry 48 hours * feat: include destroy event * feat: set expiry to 72 days * fix: typo * test: cache update after `touch` * test: update cache keys * refactor: remove after_touch, it's already handled in commit
This commit is contained in:
@@ -43,10 +43,13 @@ RSpec.describe 'Super Admin accounts API', type: :request do
|
||||
it 'shows the list of accounts' do
|
||||
expect(account.cache_keys.keys).to contain_exactly(:inbox, :label, :team)
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
|
||||
now_timestamp = Time.now.utc.to_i
|
||||
post "/super_admin/accounts/#{account.id}/reset_cache"
|
||||
expect(response).to have_http_status(:redirect)
|
||||
expect(flash[:notice]).to eq('Cache keys cleared')
|
||||
expect(account.reload.cache_keys.values.map(&:to_i)).to eq([0, 0, 0])
|
||||
|
||||
expect(account.reload.cache_keys.values.all? { |v| v.to_i == now_timestamp }).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user