From: <php...@li...> - 2006-07-27 01:47:07
|
Hi, > dedicated application. But in my case, I want to > build an easy to > distribute/deploy PHP component requiring only the > minimim work of > installing the memory cache is the easiest solution I can think of. A file cache requires much more work, every node has to serialize the data to java.io.tmpdir (that's the only directory to which J2EE or SEL has write access) and make sure that all other nodes don't update or read the cache while one node updates the data. If the data doesn't fit into memory or into java.io.tmpdir, you'll need a decicated cache daemon which listens on some port, updates its database regularily and answers requests from the nodes. Users could start this daemon, if they want to: java -jar luceneCacheDaemon.jar If a Socket(daemonPort) fails during startup of a node you could revert to memory cache: public class fooFactory { private static Foo foo; private static final Socket cacheDaemon; static { try { cacheDaemon = new Socket(DAEMON_PORT); } catch (IOException e) {/*ignore*/} } public static synchronized foo getFoo() { if(foo!=null) return foo; if(cacheDaemon!=null) return foo=getFoo(cacheDaemon); return foo = createFoo(); } } > to native code yet (but will do, curious about the > performance with > respect to a VM install) Starting a native lucene .so costs about 100 to 150 ms. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |