You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extensions/modules/cache/src/main/java/org/exist/xquery/modules/cache/CacheFunctions.java
+18-7Lines changed: 18 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ public class CacheFunctions extends BasicFunction {
62
62
"Explicitly create a cache with a specific configuration",
63
63
returns(Type.BOOLEAN, "true if the cache was created, false if the cache already exists"),
64
64
FS_PARAM_CACHE_NAME,
65
-
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 specified 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\"} }")
65
+
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\"} }")
66
66
);
67
67
68
68
privatestaticfinalStringFS_NAMES_NAME = "names";
@@ -159,7 +159,7 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
159
159
cacheName = null;
160
160
}
161
161
162
-
switch(getName().getLocalPart()) {
162
+
switch(getName().getLocalPart()) {
163
163
164
164
caseFS_CREATE_NAME:
165
165
if(CacheModule.caches.containsKey(cacheName)) {
@@ -173,7 +173,7 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
173
173
caseFS_PUT_NAME:
174
174
// lazy create cache if it doesn't exist
175
175
if(!CacheModule.caches.containsKey(cacheName)) {
176
-
createCache(cacheName, newCacheConfig());
176
+
lazilyCreateCache(cacheName);
177
177
}
178
178
finalStringputKey = toMapKey(args[1]);
179
179
finalSequencevalue = args[2];
@@ -182,30 +182,30 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
thrownewXPathException(this, LAZY_CREATION_DISABLED, "There is no such named cache: " + cacheName + ", and lazy creation of the cache has been disabled.");
staticfinalErrorCodes.ErrorCodeINSUFFICIENT_PERMISSIONS = newCacheModuleErrorCode("insufficient-permissions", "The calling user does not have sufficient permissions to operate on the cache.");
107
128
staticfinalErrorCodes.ErrorCodeKEY_SERIALIZATION = newCacheModuleErrorCode("key-serialization", "Unable to serialize the provided key.");
129
+
staticfinalErrorCodes.ErrorCodeLAZY_CREATION_DISABLED = newCacheModuleErrorCode("lazy-creation-disabled", "There is no such named cache, and lazy creation of the cache has been disabled.");
0 commit comments