Dear Sling-Devs, A long time ago, I proposed implementing resource based caching in Sling: http://apache-sling.73963.n3.nabble.com/Idea-Caching-in-Sling-td4036886.html
I did get some nice feedback, but unfortunately the daily life forces proved to be too strong and I never followed up on this. Finally, a few months ago I decided to start a POC and I feel that’s in a state where I can share it with you. The idea in a nutshell: Cache the output of Sling requests in memory (infinispan) Allow developers to configure component behavior (e.g. re-render specific components for each request) Source Code and Documentation can be found here: https://gitlab.com/hit-the-cache-jack/hit-the-cache-jack/wikis/home Some points to consider: Code is for a POC, I think it’s in reasonably good state but of course far from production coding standards The code has some AEM dependencies, but I have already implemented the concepts to make this 100% sling specific I have set up a demo environment with one AEM Publish instance running the We-Retail application. The following things can be observed there: Top navigation is cached correctly for both logged in and anonymous users Cart is displayed in top navigation correctly per user, adding items to the cart works CSRF tokens are generated correctly All the regular page content is fully read from the in memory cache. The demo environment can be accessed in three ways: · direct access with caching POC enabled · Cloudflare-caching for static content (images, JS and CSS files) POC code used for all other content · Default AEM dispatcher cache (sling caching POC is disabled) Feel free to log in with user1/user1 or user2/user2 to test the cart. I know this is quite a significant intervention into how sling works, there are quite a few risks associated with this that I may not even be aware of. Still, if you think this could be interesting to be integrated into Sling in one way or another, I’m very happy to donate my source code. I hoped I would be able to join adapt.to to discuss this with you, but I can’t make it for more than one day, so I decided to skip adapt.to (again) this year. Would be great to get some feedback if this is of any interest to you and maybe even get some input on what must be improved and changed. Thanks for any feedback! Ben -- Ben Zahler Hit the code jack gmbh | Bergweg 17 | CH-4450 Sissach Phone: +41 79 570 8052 | https://www.hitthecodejack.com/
