-
1. Re: Multiple Cache Loaders
lords_diakonos Jul 1, 2009 12:51 PM (in response to lords_diakonos)OK I have tried to extend the FileCacheLoader and use that to test what I am after. The issue is that I have break points on isCharacterPortableTree and isCharacterPortableLocation but I am not hitting either method and I don't understand why. I know my class is being loaded as I also put a break point in the constructor. But my get, puts or isCharacterPortableLocation methods are never called.
I was hoping to do this and test my case mentioned above to ignore a specific region in this cacheLoader. Basically I don't want one of the regions in disk cache but only memory cache.
My config is as follows<attribute name="IsolationLevel">READ_COMMITTED</attribute> <attribute name="CacheLoaderConfig"> <config> <passivation>false</passivation> <cacheloader> <class>com.dotmarketing.business.TestLoader</class> <properties> location=/Users/jasontesser/dev/dotcms/trunk/cachetest check.character.portability=true </properties> <async>false</async> <fetchPersistentState>true</fetchPersistentState> <ignoreModifications>false</ignoreModifications> </cacheloader> </config> </attribute>
And my classpublic TestLoader() { super(); } @Override public Map get(Fqn fqn) throws Exception { // TODO Auto-generated method stub return super.get(fqn); } @Override public void put(Fqn arg0, Map arg1, boolean arg2) throws Exception { // TODO Auto-generated method stub super.put(arg0, arg1, arg2); } @Override public Object put(Fqn arg0, Object arg1, Object arg2) throws Exception { // TODO Auto-generated method stub return super.put(arg0, arg1, arg2); } @Override public void put(Fqn fqn, Map attributes) throws Exception { // TODO Auto-generated method stub super.put(fqn, attributes); } @Override public void put(List<Modification> arg0) throws Exception { // TODO Auto-generated method stub super.put(arg0); } protected boolean isCharacterPortableLocation(String fileAbsolutePath) { if(fileAbsolutePath.indexOf("VelocityCache")>-1){ return false; } return true; // return super.isCharacterPortableLocation(fileAbsolutePath); } protected boolean isCharacterPortableTree(Fqn fqn) { List elements = fqn.peekElements(); // Don't assume the Fqn is composed of Strings!! for (Object anElement : elements){ if(anElement.toString().contains("VelocityCache")){ return false; } } return true; // return super.isCharacterPortableTree(fqn); }
-
2. Re: Multiple Cache Loaders
lords_diakonos Jul 1, 2009 1:34 PM (in response to lords_diakonos)I guess I had to make the methods public but still how do I configure what I am after?
-
3. Re: Multiple Cache Loaders
mircea.markus Jul 2, 2009 4:07 AM (in response to lords_diakonos)There's no out of the box support for this, I'm afraid. One way to approach it is to create a delegating cache loader, that can be configured to only handle a given region (children of a given fqn).
Then this new cache loader can be used to wrap the actual cache loaders you want to use, and make each one of them take care of a single region. Take a look at how ReadOnlyDelegatingCacheLoader is implemented, you need something similar.