Caching for findBySlug - Overwrite method from another module?

Hi @all,

out of some pages and their children I´m generating a custom view. The pages are disabled, have no own URL. The content is shown on some pages.

pages = cb.getPageService().findBySlug('xxx', true).getChildren();

So I am not using the render method to display the content. I grab some stuff out of the pages and display it an a view. So I have no caching at all.

What would be cool is to overwrite the method findBySlug(). An optional parameter could then decide, if the result should be cached or not.
Is there a nice way to overwrite the method out of another module? I do not want to change the core or write an plugin.

Cheers
Andy

AOP…

This is probably your best and easiest solution, but the content is not cached there, nor would it be practical to try and cache it there either.

Another option is just to write a service of your own that proxies to the ContentBox services but employs the caching for you.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Andy, you have full access to the API when you install COntentBox. Why not create your own PageService that does whatever you need and decorates the core page service?

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Hi, today I checked the article about AOP. For me it seems to be the best solution. After some testing caching is done very smart…

So no other service is needed, just a binding and the rest is straight forward.

Support here is great and you always offer many possible solutions.

Cheers Andy

signature0.jpg