-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve caching mechanism #184
Conversation
...-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/CacheManager.java
Outdated
Show resolved
Hide resolved
...-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/CacheManager.java
Outdated
Show resolved
Hide resolved
...-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/CacheManager.java
Outdated
Show resolved
Hide resolved
* @param cacheKey key to lookup, i.e. update-center | ||
* @return the cached json object as a string or null | ||
*/ | ||
public String retrieveFromCache(String cacheKey) { |
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 would introduce a simple POJO
public String retrieveFromCache(String cacheKey) { | |
public CacheItem retrieveFromCache(String cacheKey) { | |
`` |
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.
Also a bit more context. If we add a class CacheItem (abstract or not) it means that we can cache entities like Plugin
or other content
@@ -30,4 +44,62 @@ void createCache() { | |||
} | |||
} | |||
} | |||
|
|||
public void addToCache(String cacheKey, String value) { |
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.
public void addToCache(String cacheKey, String value) { | |
public void addToCache(String cacheKey, CacheItem item) { |
private final Path cache; | ||
private final Clock clock; |
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.
Why is it a member ? My feeling is that a simple static constant would fit
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.
Hey @jonesbusy Doesn't a member useful for testing purposes?
...-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/CacheManager.java
Outdated
Show resolved
Hide resolved
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.
Thanks for your PR, some minor code changes required
…dernizer/core/impl/CacheManager.java Co-authored-by: Valentin Delaye <jonesbusy@users.noreply.github.com>
Let me know if you prefer to merge as is and improve later. Remaining point are not blocking for me |
We can merge it |
Closes #176
Testing done
interactive tests + unit tests
Submitter checklist