jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edgar Poce <edgarp...@gmail.com>
Subject Re: Getting "custom" objects from the repository?
Date Sat, 16 Apr 2005 21:35:05 GMT
Hi daniel

Daniel Dekany wrote:
 > I would be happily build a such framework, but I don't see how... JCR
 > nodes doesn't even have some kind of automatically maintained
 > last-modified property that I could use for quickly checking if the
 > object in the cache is outdated or not. It is almost everything that is
 > needed for the happiness. Seems to me such a low hanging fruit...
 >
 > Node n = (Node) session.getItem("/foo/theTemplate");
 > cacheEntry = cache.get("/foo/theTemplate");
 > if (!n.getStamp().equals(cacheEntry.getStamp())) {
 >     The cached object is outdated, so let's recreate using the
 >     current value of the insertsomethinghere property.
 > } else {
 >     return cacheEntry.getObject()
 > }
 >

I guess you can do it by creating a custom node type with a mandatory 
property that stores the last update timestamp. WDYT?
the first line of your example would be something like:
Property p = (Property) 
session.getItem("/foo/theTemplate/mapping:lastUpdate");

But since graffito, lenya and jackrabbit communities are interested in 
such a tool it would be cool to work together, that would be the apache 
way, right? :). AFAIK the proposal discussed in the graffito dev list 
deals with many of the issues you are talking but I didn't see any 
reference to a cache with already mapped objects.

regards
edgar

Mime
View raw message