Thomas Martin ha scritto:

Hi List

I'm looking for a way to remove the cache of a website from within the code.

Hi Thomas.
I'm not sure 100% that it is the only option, but I think that you can reach your need implementing a custom CachePolicy.

The default CachePolicy (info.magnolia.....cachepolicy.Default) uses EHCache to store full page rendered code with a key represented by full page url.

To set a custom cachePolicy go under CONFIG > modules > cache > config > configuration > default > cachepolicy and overwrite the default cache policy class.

Remember to extend the default cache policy class to keep the code effort at minimum.

We have implemented our cache policy wich uses a separated page cache manager (a simple RAM-based singleton with synchronized interface methods) and doing that we can flush the entire site cache simply clearing our custom cache (Cache.reset()). We intercept this command into our template renderer, because we have only 1 tpl renderer. But you can also use a custom filters, so that you can flush the cache from URL. Using a save handler is anyway an option, of course..

PS: our cache policy keep a page cached only for 1 minute, because we have a lot of user-generated content too (pages are much dynamic).

HTH
Matteo


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to