-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add support in cache:create()
for 'expireAfterWrite' in $config
#4975
Add support in cache:create()
for 'expireAfterWrite' in $config
#4975
Conversation
@nverwer Thank you for this PR! I see it's opened against the develop-6.x.x branch. I'm curious, do you plan to port it to develop so it's available for eXist 7.x and beyond? |
Thanks @nverwer ! This has been a long-standing request from our side, but which never made it to the issue list. |
@joewiz I could also put this in develop, but I would first have to get compilation working in Java 17. |
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.
ok
a97bda0
to
49f97ce
Compare
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.
There is a small issue in the documentation of the new function parameter. Once that is resolved, this is good to go. Thanks @nverwer
@@ -62,7 +62,7 @@ public class CacheFunctions extends BasicFunction { | |||
"Explicitly create a cache with a specific configuration", | |||
returns(Type.BOOLEAN, "true if the cache was created, false if the cache already exists"), | |||
FS_PARAM_CACHE_NAME, | |||
param("config", Type.MAP, "A map with configuration for the cache. At present cache LRU and permission groups may be specified, for operations on the cache. `maximumSize` is optional and specifies the maximum number of entries. `expireAfterAccess` is optional and specifies the expiry period for infrequently accessed entries (in milliseconds). If a permission group is not specified for an operation, then permissions are not checked for that operation. Should have the format: map { \"maximumSize\": 1000, \"expireAfterAccess\": 120000, \"permissions\": map { \"put-group\": \"group1\", \"get-group\": \"group2\", \"remove-group\": \"group3\", \"clear-group\": \"group4\"} }") | |||
param("config", Type.MAP, "A map with configuration for the cache. At present cache LRU and permission groups may be specified, for operations on the cache. `maximumSize` is optional and specifies the maximum number of entries. `expireAfterAccess` is optional and specifies the expiry period for infrequently accessed entries (in milliseconds). `expireAfterAccess` is optional and specifies the expiry period after the entry's creation, or the most recent replacement of its value (in milliseconds). If a permission group is not specified for an operation, then permissions are not checked for that operation. Should have the format: map { \"maximumSize\": 1000, \"expireAfterAccess\": 120000, \"permissions\": map { \"put-group\": \"group1\", \"get-group\": \"group2\", \"remove-group\": \"group3\", \"clear-group\": \"group4\"} }") |
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.
There are two entries here for expireAfterAccess
!
Presumably the second should instead be expireAfterWrite
?
Additionally, an example for expireAfterWrite
should be added to the Should have the format: map
example.
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 @adamretter for spotting this. I have made changes accordingly.
I have made a new pull request #4977 for the develop branch (eXist 7.x.x). |
ac1d498
to
a56bdec
Compare
a56bdec
to
76a633e
Compare
cache:create()
for 'expireAfterWrite' in $config
cache:create()
for 'expireAfterWrite' in $config
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.
LGTM. Thanks @nverwer
SonarCloud Quality Gate failed. 2 Bugs 78.3% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Description:
This feature adds a configuration option 'expireAfterWrite' to the
$config
parameter ofcache:create()
.This option is available in the Caffeine cache, but was not supported in eXist.
Reference:
I have not made a GitHub issue requesting this feature.
Type of tests:
A test has been added to
extensions\modules\cache\src\test\xquery\modules\cache\cache.xqm
.It is similar to the test for
expireAfterAccess
.