I have a list of product names that I query from database to build a menu on my website. I thought it would be better if I could cache the query results.
Now, my question is what would be the ideal approach for caching queries? Should I use a plain solution, like storing the results into APPLICATION scope variable? Or, use CacheBox?
Any thoughts? Thank you!
By the way, I am relatively a new ColdBox adopter.
I ended up using viewlets. I did try the CacheBox thing as Jim pointed out. It worked fine at the beginning, but as I worked more, my services threw unexpected errors such as stack overflow and variable not found in arguments. I will revisit again the issue in the future. Viewlets with cache=“true” is good enough for my needs now.
Glad to hear you’ve got that working. Also, for what it’s worth, cache=true on your views just uses CacheBox seamlessly behind the scenes— specifically the “template” cache. Make sure you tune your cache size according to your application.