Most simple approach would be:
CacheModule.getCacheFactory().getCache(name).clear();
You can get names of existing caches from the
CacheModule.getConfigurations().values();
And you can get CacheModule instance from the ModuleRegistry as follows
ModuleRegistry.Factory.getInstance().getModuleInstance("cache");
Cheers,
Jan
On Mon, 2009-03-30 at 10:07 +0200, Matteo Pelucco wrote:
> 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]>
> ----------------------------------------------------------------
--
Best regards,
Jan Haderka
Magnolia International Ltd.
----------------------------------------------------------------------
[email protected] http://www.magnolia-cms.com
Magnolia® - Simple Open Source Content Management
----------------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------