-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHEF-3961: Implement caching ability at application-level for the API calls #154
base: main
Are you sure you want to change the base?
Conversation
3764973
to
6676bb8
Compare
class CacheManager | ||
DEFAULT_TTL = 60 | ||
def initialize(cache_dir = nil) | ||
@cache = ActiveSupport::Cache::FileStore.new(cache_dir || Dir.tmpdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need to provide an optional cache_dir
. Do you have any particular use case? if not I would prefer abstracting it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using the cache_dir
during testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can stub it
components/ruby/lib/chef-licensing/restful_client/cache_manager.rb
Outdated
Show resolved
Hide resolved
4ab2d5d
to
07c3f00
Compare
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
…r to base Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
enable cache manager to be passed in base class of restful client Signed-off-by: Sonu Saha <sonu.saha@progress.com>
…e disk Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
4944dcf
to
9314df5
Compare
…e_manager Signed-off-by: Sonu Saha <sonu.saha@progress.com>
…lass Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
…onnection in FaradayConnHandler; add comments Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Description
This PR introduces application-level caching of the API responses by using the cache manager i.e.
ChefLicensing::RestfulClient::CacheManager
implemented in this PR.It maintains a list of the endpoints
CACHE_ENDPOINTS
inChefLicensing::RestfulClient::V1
class for which the response needs to be cached at the application level.Currently, the list contains only the
/v1/client
endpoint and the list can be extended as required (or the filtering of the endpoints to cache can be removed if we desire to cache for all the endpoints).The characteristics of the cache manager is as below:
ActiveSupport::Cache
library[Other characteristics are yet to be decided]
Related Issue
CHEF-3961: Ability to cache based on per license basis and not at the network level
Types of changes
Checklist: