Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 779 invoked from network); 30 Mar 2006 19:38:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Mar 2006 19:38:30 -0000 Received: (qmail 2346 invoked by uid 500); 30 Mar 2006 19:38:27 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 2269 invoked by uid 500); 30 Mar 2006 19:38:27 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 2258 invoked by uid 99); 30 Mar 2006 19:38:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Mar 2006 11:38:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Mar 2006 11:38:26 -0800 Received: from ajax.apache.org (localhost.localdomain [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id C9C306ACB1 for ; Thu, 30 Mar 2006 20:38:05 +0100 (BST) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: commons-dev@jakarta.apache.org Date: Thu, 30 Mar 2006 19:38:05 -0000 Message-ID: <20060330193805.32244.12406@ajax.apache.org> Subject: [Jakarta-commons Wiki] Update of "VfsCacheStrategy" by MarioIvankovits X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Dear Wiki user, You have subscribed to a wiki page or wiki category on "Jakarta-commons Wiki" for change notification. The following page has been changed by MarioIvankovits: http://wiki.apache.org/jakarta-commons/VfsCacheStrategy New page: = VFS - CacheStragey = One problem with libraries like vfs is that they cache some data to avoid successive access to the real file - simply to speed up things. This cache might get stale - no it GET stale. Currently VFS provides three strategies to workaround it: * manual * on resolve (the default) * on call Note: It is not possible to use {{{VFS.getManager}}} to configure the cacheStrategy. You have to create your own static class to create it. == manual cache strategy == Setup {{{ StandardFileSystemManager fs = new StandardFileSystemManager(); fs.setCacheStrategy(CacheStrategy.MANUAL); fs.init(); }}} using this setup you have to use {{{fileObject.refresh()}}} to refresh your object with the filesystem == on_resolve == Setup {{{ StandardFileSystemManager fs = new StandardFileSystemManager(); fs.setCacheStrategy(CacheStrategy.ON_RESOLVE); fs.init(); }}} every time you call {{{fs.resolveFile()}}} the file data will be refreshed. You still can use {{{fileObject.refresh()}}} to refresh the data on demand. == on_call == Setup {{{ StandardFileSystemManager fs = new StandardFileSystemManager(); fs.setCacheStrategy(CacheStrategy.ON_CALL); fs.init(); }}} Every time you call a method on the resolve file object the data will be refreshed with the filesystem. This will give you the behaviour you might expect from a local file but also might be a hughe performance loss as it will greatly increase the network load. You also can archive this cache strategy if you pack the file object in an {{{org.apache.commons.vfs.cache.OnCallRefreshFileObject}}} {{{ FileObject fo = VFS.getManager().resolveFile("...."); OnCallRefreshFileObject foc = new OnCallRefreshFileObject(fo); }}} the difference to the above is, that in the first case you will always get the same file object instance and thus you can synchronize against it. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org