[seam-dev] Page fragment cache with JBoss Treecache, ehcache and a FileSystemCache

Sebastian Hennebrueder usenet at laliluna.de
Fri May 2 18:04:02 EDT 2008


Hello,

I was working on the http://jira.jboss.com/jira/browse/JBSEAM-1891
and created three caching alternatives which can now be plugged in.

As this is the first thing I write, I would appreciate a feedback, if 
the provided solution is what Christian was actually looking for and if 
I should continue this or made something completely useless.

I attached the files and testng tests. If this is considered useful, I 
can provide a SVN patch as well. All files are new anyway.

Cache Provider:
JBoss TreeCache 1.4
API changes a lot from 1.4 to 2, so we must be careful once the
I did not use the PojoCache as we have only simple Strings and no 
complex beans. In that case PojoCache provides only overhead. (info 
taken from pojocache wiki).

Eh-Cache
I did not enforce any Transaction guaranties (like READ_COMMITED) as we 
have in Hibernate for example.

FileSystemCache
Manually written, idea: a large site cannot be hold in a cache being 
present in memory. This cache has a small in memory area holding very 
frequent files (size can be configured) and fetches files from disk.
Though the operation system caches access to disk, this is still a lot 
slower than memory access but probably faster than having complex 
queries to the database (see Seam Wiki queries)

The Cache can already be used in a web application using a custom 
renderer kit.
example for components.xml
<component class="org.jboss.seam.cache.PageFragmentCache">
     <property name="provider">#{filecache}</property>
</component>
<component class="org.jboss.seam.cache.FileSystemCacheProvider" 
name="filecache">
   <property name="boostBufferSize">50</property>
   <property name="enableStatistics">true</property>
</component>
<component class="org.jboss.seam.statistics.StatisticsManager" />


Another idea:
I introduces a StatisticsManger component which might be used by any 
components providing statistic information. This would provide one place 
  to access statistics of the application or to print a report. If you 
like the idea, I would add a MBean wrapping this StatisticsManager else 
I'll just remove it from the cache providers.

Some questions:
I did not find a way to access the name of the application (web context) 
to use it as prefix for the JBoss TreeCache in case we use multiple 
applications on the same system.

Is there a common way to load resources like configuration files? I saw 
different approaches in the core code.


Best Regards

Sebastian Hennebrueder
laliluna.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cache.zip
Type: application/zip
Size: 25843 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/seam-dev/attachments/20080503/c7f59714/attachment.zip 


More information about the seam-dev mailing list