royteeuwen commented on code in PR #40:
URL:
https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/40#discussion_r1271452457
##########
src/main/java/org/apache/sling/servlets/resolver/internal/helper/AbstractResourceCollector.java:
##########
@@ -197,5 +209,52 @@ private String getScriptExtension(String scriptName) {
}
return null;
}
+
+ /**
+ * Retrieves the list of children for a resource
+ * @param parent the resource for which the children should be retrieved
+ * @param useCaching if true try to read the list from the cache
+ * @return the children (or an empty list of no children are present)
+ */
+ static List<Resource> getChildrenList(Resource parent, boolean useCaching)
{
+
+ List<Resource> childList = new ArrayList<>();
+ if (useCaching) {
+
+ // init the caching structure
+ Map<String,List<Resource>> childrenListMap = new HashMap<>();
+ Map<String,Object> cache =
parent.getResourceResolver().getPropertyMap();
+ if (!cache.containsKey(CACHE_KEY_CHILDREN_LIST)) {
+ childrenListMap = new HashMap<>();
Review Comment:
Using propertyMap for caching Resources does seem to be a dangerous road to
go into. What if a resourceResolver.refresh actions occur's in between?
shouldn't this be reflected?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]