Error: Main method not found in class com.percussion.server.cache.PSCacheProxy

I am hoping I can use this class to programatically flush the caches. Does anyone know if this is possible and if so how do I go about calling the flushAll method?

Thanks

Thank you for your question, Sean. I will follow up with the Percussion team.

Sean,

The server has a Cache Manager that is responsible for managing classes.  

If your extension is running natively then you should be able to use something like the following:

import com.percussion.server.cache.PSCacheManager;



cacheMgr = PSCacheManager.getInstance();

cacheMgr.flush();

You should also be able to get an Iterator of string objects with the list of caches managed by the cache manager by calling the getCacheTypes(); method on the same object. 

Hope this helps. 

-n

Ooh so a quick groovy script could be the answer.

I will let you know how I get on.

Thanks very much

Sean

Sean,

Did this solve your problem?

-n

This reply was created from a merged topic originally titled Can you programmatically invoke a “flush cache”?.

We’d like to be able to trigger a flush cache either before an edition runs (does the sys_flushPuclicationCache extension do this?) or via the command line so we can perhaps add it as a web resource build step.

Is it possible?

Cheers,

Andrew

Not had a lot of time to look at it Nate. I was getting an error saying that the cacheManager needed to be initialised. I will look in to it further today.

Sean

I think there might be two alternative options.  The first os to exclude web_resources folder from the cache, the second is to exclude specific file types (CSS, hbs, js) from it (although I don’t want to slow down anything outside web_resources).

These may be easier?

Sean / Andrew,

In a proper Post Edition Task java extension, the CacheManager reference should work.   Using an external Command Task won’t work because that is a native API that needs to be called from an extension running inside the Rhythmyx server.   It doesn’t look like the PSO Toolkit has any existing Post Edition tasks.  You could Fork that project on GitHub, and add a new Extension that implements the IPSEditionTask interface that does the cache restarting.

The Toolkit is open source and we’d be happy to accept a pull request for this.  

-n

I  have tried initialising the CacheManager using:

new PSCacheManager().init()

This gives me the following error

Caught: java.lang.IllegalArgumentException: cacheSettings may not be null
java.lang.IllegalArgumentException: cacheSettings may not be null
at com.percussion.server.cache.PSCacheManager.init(Unknown Source)

Is there anywhere I can get a list of what cachesettings I can use?

Cheers

Sean

Sean,

It is a Singleton so you should use PSCacheManager.getInstance().flush();

-n

Thanks Nate

It still wants the CacheManager to be initialised.

Sean

Are you running inside of a Java extension or as an external program?

-n

I am trying to run it from within a groovy script

For this method to work you need to be running in process as a Java extension. 

-n