Skip to content
Snippets Groups Projects
Unverified Commit 0e558653 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Scope cache keys to v3 (#5285)

parent 5305517e
Branches
Tags release-3.0.5.1
No related merge requests found
......@@ -25,7 +25,7 @@ module Api
# GET /api/v1/locales
# Returns a cached list of locales available
def index
language_with_name = Rails.cache.fetch('locales/list', expires_in: 24.hours) do
language_with_name = Rails.cache.fetch('v3/locales/list', expires_in: 24.hours) do
language_hash = {}
languages = Dir.entries(Rails.root.join('app/assets/locales')).select { |file_name| file_name.ends_with?('.json') }
......
......@@ -30,7 +30,7 @@ class ProviderCredentials
# Cache the response for an hour
# fetch will return the value if already cached, if not, it will compute the value, cache it, then return it
Rails.cache.fetch("#{@provider}/#{@route}", expires_in: 1.hour) do
Rails.cache.fetch("v3/#{@provider}/#{@route}", expires_in: 1.hour) do
url = URI.parse("#{@endpoint}#{@route}?#{encoded_params}&checksum=#{checksum}")
res = Net::HTTP.get_response(url)
......
......@@ -61,7 +61,7 @@ describe ProviderCredentials, type: :service do
service.call
expect(service.call).to eq(['https://test.com', 'secret'])
expect(Rails.cache.read('bbb/getUser')).to eq(['https://test.com', 'secret'])
expect(Rails.cache.read('v3/bbb/getUser')).to eq(['https://test.com', 'secret'])
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment