Configuration

How do I enable the distribution?

There are some different possibilities:

  1. Modify the jcache.properties file directly in the jar (set 'distribute = true')
  2. Modify an external jcache.properties and reference this when initializing FKache.
     
    					CacheAccessFactory factory = 
    					CacheAccessFactory.getInstance(); this.cache = 
    					factory.getCache(false); 
    					cache.open("path-to-jcache.properties");
  3. Set the distribution programatically:
     
    					//default CacheAttributes are distributed. CacheAttributes 
    					catt = CacheAttributes.getDefaultCacheAttributes(); 
    					CacheAccessFactory factory = 
    					CacheAccessFactory.getInstance(); this.cache = 
    					factory.getCache(false); cache.init(catt);

[top]

I have enabled the distribution, but it sais the Jache is local, whats wrong?
It is probably because the cache already have been initialized when you call javax.util.JCache.open() Check what value you get from javax.util.JCache.isReady() right before you call javax.util.JCache.open(). If its false, and you have correctly enabled the distribution, and the distribution is still inactive after the open() call, its a bug. Please report it. If its true, everything is hunky dory, you have already initialized FKache some other place in your code. Now its your task to hunt and destroy the unwanted initialization.
[top]

FKache Usage

How do I explicitly delete a specific object from the cache?
You can use the Map interface for this particular problem.
					Map map = CacheAccessFactory.getInstance().getMapAccess();
					map.remove("ObjectToBeRemoved");
				
				
[top]

Problems

I use FKache on JBOSS/WebSphere or another J2EE server, and I am not able to share objects across EJBs, JSPs and Servlets. I have included FKache.jar in both the ejb archives, the web-archives etc. Whats wrong? How can I work around this issue?
For now, its possible to share objects across web-archives, ejb-archives etc by adding FKache.jar to an ear and reference it from the war, rar, ejb-jar etc. For instructions/more info see EJB 2 and J2EE Packaging article in OnJava. If that artice didnt give an exact answer to your problems, there ar lots of links in that article leading to other solutions. Since FKache uses threads, its not particulary usefull to use FKache as a jar inside a war/ejb-jar etc, since the threads are not killed when the app is redeployed/undeployed etc. The solution is for now to avoid dangling threads is to put FKache.jar as a System-library for the J2EE server, so FKache is an integrated part of the J2EE server, and thus there is no need for the archive to be several places in Wars, ejb-jars etc. I will come up with a solution for this problem in some upcoming release, but since a good workaround is available, its not high priority. If someone wants to do it, feel free to contact me! I have some ideas how it should be done. :)
[top]

The bla bla bla, this and that does not work! When are you going to fix it?
I can fix it right away, if you go to the Issue Tracking page add a new bug/feature request/support request, and most important, ADD A CODE EXAMPLE! If you do that, i will do my best to sort the problem out as quick as I possibly can.
[top]