Skip to content

Conversation

@paul-bjorkstrand
Copy link
Contributor

  • Update Sling API dependency to 2.24.0 (to be able to use ResourceResolver#getPropertyMap()).
  • Create a common cache holder object for all types of caches.
  • When the adaptable is a request, continue to keep only a single cache mapping adapter types to adaptation results.
  • When the adaptable is a resource or resource resolver, store the cache holder in the appropriate resource resolver's property map (this map has the same lifecycle as the resource resolver).
  • When the adaptable is anything else, use the "global cache".
  • When the cache holder is not global, remove the use of synchronized maps (moderate performance improvement since resources/resolvers should only be used single threaded).
  • Ensure the Request cache holder's close() is called when the request is disposed.
  • Update tests where needed.
  • Add tests for new code.

Copy link
Contributor

@joerghoh joerghoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Map<Object, Object> nonSyncMap= AdapterCacheHolder.newMap(false);
Map<Object, Object> syncMap= AdapterCacheHolder.newMap(true);

System.out.println(nonSyncMap.getClass());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed they are not. Updated in latest push.

@sonarqubecloud
Copy link

@paul-bjorkstrand paul-bjorkstrand force-pushed the feature/resource-resolver-adapter-cache-SLING-12279 branch from 1a6cb02 to 2cc2610 Compare July 3, 2024 20:07
@paul-bjorkstrand
Copy link
Contributor Author

I saw that a recent change caused a couple conflicts. Fixed with the latest push.

…ver adaptables

- Update Sling API dependency to 2.24.0 (to be able to use `ResourceResolver#getPropertyMap()`).
- Create a common cache holder object for all types of caches.
- When the adaptable is a request, continue to keep only a single cache mapping adapter types to adaptation results.
- When the adaptable is a resource or resource resolver, store the cache holder in the appropriate resource resolver's property map (this map has the same lifecycle as the resource resolver).
- When the adaptable is anything else, use the "global cache".
- When the cache holder is not global, remove the use of synchronized maps (moderate performance improvement since resources/resolvers should only be used single threaded).
- Ensure the Request cache holder's `close()` is called when the request is disposed.
- Update tests where needed.
- Add tests for new code.

Remove unnecessary println

Spotless plugin cleanups

Fix merge conflicts
@paul-bjorkstrand paul-bjorkstrand force-pushed the feature/resource-resolver-adapter-cache-SLING-12279 branch from f5ac1c5 to 1ae6ec3 Compare July 9, 2024 17:07
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants