CHEF-3961: Implement caching ability at application-level for the API calls#154
Draft
CHEF-3961: Implement caching ability at application-level for the API calls#154
Conversation
3764973 to
6676bb8
Compare
| class CacheManager | ||
| DEFAULT_TTL = 60 | ||
| def initialize(cache_dir = nil) | ||
| @cache = ActiveSupport::Cache::FileStore.new(cache_dir || Dir.tmpdir) |
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
I am using the cache_dir during testing.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces application-level caching of the API responses by using the cache manager i.e.
ChefLicensing::RestfulClient::CacheManagerimplemented in this PR.It maintains a list of the endpoints
CACHE_ENDPOINTSinChefLicensing::RestfulClient::V1class for which the response needs to be cached at the application level.Currently, the list contains only the
/v1/clientendpoint 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::Cachelibrary[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: