SLING11982 avoid repo access (#40)

Avoid repository access by caching already resolved resources in the ScriptResolver's propertyMap.

As the ResourceResolver used here (the ScriptResolver) is private to this bundle (either stored as a ThreadLocal to a request or as the sharedResolver) and is not exposed to an external party, its lifecycle is controlled:
* Either the ResourceResolver is created fresh for every request (and closed when the request is finished)
* or it lives along with the sharedResolver.

So in the first case (request) we don't need to care about clearing any caches. For the 2nd case there is an explicit cache invalidation, when the sharedResolver is re-acquired.

This feature is enabled by default, and can be turned off via OSGI (the property "enable.resource.caching" on PID "org.apache.sling.servlets.resolver.internal.SlingScriptResolverImpl").


7 files changed
tree: acf74902ac0ea13560286c23b123d668f21fec1c
  1. src/
  2. .asf.yaml
  3. .gitignore
  4. bnd.bnd
  5. CODE_OF_CONDUCT.md
  6. CONTRIBUTING.md
  7. findbugs-exclude.xml
  8. Jenkinsfile
  9. LICENSE
  10. pom.xml
  11. README.md
README.md

Apache Sling

Build Status Test Status Coverage Sonarcloud Status JavaDoc Maven Central servlets License

Apache Sling Servlet Resolver

This module is part of the Apache Sling project.

Bundle implementing the Sling API ServletResolver. See the servlets and scripts documentation for how this works.