You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by "Mauro S. Asprea" <ma...@nektra.com> on 2008/06/02 23:15:49 UTC

Re: JCS.setConfigFilename

Yes Jorge, the objects must be Serializable. Thanks!

Jorge Medina wrote:
> Hi Mauro, 
>
> What do you want to achieve?
>
> Why is MaxObjects=0 ? 
> http://jakarta.apache.org/jcs/RegionProperties.html
>
> I would assume that if you are using auxiliaries, that the elements you
> want to cache must implement the Serializable interface. 
>
> -Jorge
>
> -----Original Message-----
> From: Mauro S. Asprea [mailto:mauro.asprea@nektra.com] 
> Sent: Wednesday, May 28, 2008 6:19 PM
> To: JCS Users List
> Subject: Re: JCS.setConfigFilename
>
> Thanks Jorge it worked :)
> Now I have another issue. JCS isn't caching anything...
> My config is as following
>
>     ##############################################################
>     ##### Default Region Configuration
>     jcs.default=DC
>  
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
> es
>     jcs.default.cacheattributes.MaxObjects=0
>  
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory
> .lru.LRUMemoryCache
>
>     ##############################################################
>     ##### CACHE REGIONS
>     jcs.region.myRegion1=DC
>  
> jcs.region.myRegion1.cacheattributes=org.apache.jcs.engine.CompositeCach
> eAttributes
>     jcs.region.myRegion1.cacheattributes.MaxObjects=0
>  
> jcs.region.myRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engi
> ne.memory.lru.LRUMemoryCache
>
>
>     ##############################################################
>     ##### AUXILIARY CACHES
>     # Indexed Disk Cache
>  
> jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
> actory
>  
> jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
> dDiskCacheAttributes
>     jcs.auxiliary.DC.attributes.DiskPath=c:/Developing
>     test/NNTPSync/etc/cache
>     jcs.auxiliary.DC.attributes.MaxPurgatorySize=10000
>     jcs.auxiliary.DC.attributes.MaxKeySize=10000
>     jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=300000
>     jcs.auxiliary.DC.attributes.OptimizeOnShutdown=true
>     jcs.auxiliary.DC.attributes.MaxRecycleBinSize=7500
>
> I'm calling the cache like this:
>
>     JCS.setConfigFilename("/cache.ccf");
>     cache = JCS.getInstance("myRegion1");
>     IElementAttributes attributes = cache.getDefaultElementAttributes();
>     attributes.setIsEternal(true);
>     attributes.setIsSpool(true);
>     cache.setDefaultElementAttributes(attributes);
>
> Logging the put and gets and printing the keys I realize that isn't 
> working. Example of my output:
>
>     get() :: news.nkt:::nkt.company.blog //Did'n found becose is first
> time
>     get() :: news.nkt:::listNewsgroups()  //Did'n found becose is first
> time
>     put() :: news.nkt:::listNewsgroups() //First cache.put
>     get() :: news.nkt:::listNewsgroups()
>     put() :: news.nkt:::nkt.company.blog
>     [...Output the data I'm retriving...]
>     //the second round where all must be cached, without stop the
>     aplicattion
>     get() :: news.nkt:::nkt.company.blog //this cache.get retrieves
>     null, should be cached already
>     get() :: news.nkt:::listNewsgroups() //this cache.get retrieves
>     null, should be cached already
>     put() :: news.nkt:::listNewsgroups()
>     get() :: news.nkt:::listNewsgroups()
>     put() :: news.nkt:::nkt.company.blog
>     [...Output the data I'm retriving...]
>
>
> I wonder if the object to be cached must be of some particular type, 
> maybe they must implement some interface?
>
> Thanks!
>
>
>
> Jorge Medina wrote:
>   
>> JCS looks for the file at the root of the classpath.
>>
>> If your code compiles to the directory  "classes\com\nektra\
>> ...\MyClass.class", then make sure the file cache.ccf is located right
>> under "classes\"
>>
>> If you are creating a JAR file with your classes, include the
>>     
> cache.ccf
>   
>> in the top directory.
>>
>>
>> -Jorge
>>
>> -----Original Message-----
>> From: Mauro S. Asprea [mailto:mauro.asprea@nektra.com] 
>> Sent: Wednesday, May 28, 2008 2:39 PM
>> To: jcs-users@jakarta.apache.org
>> Subject: JCS.setConfigFilename
>>
>> Hi, I'm having aa issue when trying to set the config.ccf file path.
>> My code is:
>>
>>                     JCS.setConfigFilename("cache.ccf");
>>                     cache = JCS.getInstance("default");
>>
>> And I'm getting the following exception
>>
>>     Failed to load properties for name [cache.ccf]
>>     java.lang.IllegalStateException: Failed to load properties for
>>     
> name
>   
>>     [cache.ccf]
>>         at
>>  
>>
>>     
> org.apache.jcs.engine.control.CompositeCacheManager.configure(CompositeC
>   
>> acheManager.java:242)
>>         at org.apache.jcs.JCS.ensureCacheManager(JCS.java:102)
>>         at org.apache.jcs.JCS.getInstance(JCS.java:64)
>>
>> I tried setting the JCS.setConfigFilename with a absolute path like 
>> "c:\mydir\mifile.ccf and the exception keeps throwing.
>>
>> So I donwloaded the code of JCS and noted that the 
>> CompositeCacheManager.configure didn't read for my dir path. How can I
>>     
>
>   
>> make him to read the file from I want to , or where in my project dirs
>>     
> I
>   
>> have to put the config file?
>>
>> I don't how to solve this... any clue?
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>>
>>
>>   
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>
>