You may want to review these two threads from the end of July: OSCache is gone http://www.mail-archive.com/dev@cayenne.apache.org/msg06209.html
EhCache integration preview http://www.mail-archive.com/user@cayenne.apache.org/msg06211.html On Fri, Sep 2, 2011 at 10:30 AM, Anthony Brew <anthony.b...@swrve.com>wrote: > Hi Andrus, > I was just about to get back to you on, I accidentally > started two threads when I joined the mailing list. > > Essentially we have a ruby on rails project that creates config on the > front > end, this is the part that is changing externally. Then internally we read > these config and do a bunch of processing and write the results to a > separate set of tables. The tables are in turn read by the R on R app but > never written to > > so > Tables Set A | Set B > ------------------------------------------------------------------------ > Rails read and write | read only > Java read only | read and write > > The issues I am facing are with set A changing in the app. > > I have tried forcing the Item to reload by doing this, (I cut code from > Cayennes: DataObjectUtils.objectForPK(threadDataContext, Item.class, > dirtyItem.getId());) > > private Item getItemWithNoCayenneCache(Item newGame, DataContext > threadDataContext) { > ObjectId gameIdentifier = buildId(threadDataContext, Game.class, > newGame.getId()); > > return (Item) DataObjectUtils.objectForQuery(threadDataContext, new > ObjectIdQuery( > gameIdentifier, > false, > ObjectIdQuery.CACHE_REFRESH)); > } > } > > > stepping into *DataObjectUtils.objectForQuery stepping into the Cayenne > code > I eventually get to DataContext.java* > * > * > where I see the following method called > > * > @Override > @SuppressWarnings("unchecked") > public List performQuery(Query query) { > query = nonNullDelegate().willPerformQuery(this, query); > if (query == null) { > return new ArrayList<Object>(1); > } > > List result = onQuery(this, query).firstList(); > return result != null ? result : new ArrayList<Object>(1); > } > * > > however i see that the delgate in * > nonNullDelegate() is null and so I get back NoopDelegate.noopDelegate which > I assume is the route of my woes. > * > * > > * > Im interested in trying the OSCache solution you proposed in my other > thread, but I am a little wary the code is stale as my maven dependancies > fail (I am actually pretty new to maven so this might be my bad). > OSCache appears to be quite old since the OpenSymphony project died, maybe > my maven config is off, are there still active contributors? > > In my pom I have specified > <dependency> > <groupId>opensymphony</groupId> > <artifactId>oscache</artifactId> > <version>2.4</version> > </dependency> > > however the dependancies on > > - javax.jms:jms:1.1 > > Thanks a Million > Anthony > > > On Fri, Sep 2, 2011 at 2:34 PM, Andrus Adamchik <and...@objectstyle.org > >wrote: > > > Could you please explain your data access patterns? > > > > E.g. if you fetch some objects and store them in an instance variable in > > your application, they are not going to get refreshed automatically. To > > refresh objects you need to either invalidate them explicitly via > > context.invalidateObjects() or run a query. All the cache settings are > > essentially about optimizing query execution (refresh data, but only as > > often as needed). > > > > Andrus > > > > On Sep 2, 2011, at 9:28 AM, Anthony Brew wrote: > > > > > Hi Gary, > > > Yeah thats what I am seeing in the code, but I cant for the > > life > > > of me see how to turn off the caching completely in the modeller, I > > actually > > > think it wont hit our performance very badly to have no caching. > > > > > > The cache setting I see are the in the DataDomain Configuration > > > > > > Which has an option for a Query Cache Factory with a choice of two > > classes. > > > - org.apache.cayenne.cache.MapQueryCacheFactory > > > - org.apache.cayenne.cache.OSQueryCacheFactory > > > > > > I selected the MapQueryCache and trie to set the size of the object > cache > > to > > > 1 (couldn't set this to zero) as the application barfed saying caches > had > > to > > > be greater than size zero. > > > > > > in my cayenne.xml I see the line > > > > > > <property name="cayenne.DataRowStore.snapshot.size" value="1"/> > > > > > > was added, perhaps there is some manual setting I can add to this file > to > > > turn caching off? > > > > > > All the Best, > > > Anthony > > > > > > > > > > > > On Fri, Sep 2, 2011 at 12:20 AM, Gary Jarrel <garyjar...@gmail.com> > > wrote: > > > > > >> I'd say that would be cache related, as Cayenne is caching the data > > >> from the database, switch the cache of in the Modeler perhaps and that > > >> should fix your problem. > > >> > > >> G > > >> > > >> On Fri, Sep 2, 2011 at 3:04 AM, Anthony Brew <anthony.b...@swrve.com> > > >> wrote: > > >>> Hi, > > >>> I have a two processes one which writes to a several database > tables > > >> (a > > >>> ruby on rails application) and a java application that reads the > state > > >> these > > >>> data base tables using Cayenne and writes to other tables. > > >>> > > >>> When the ruby modifies the underlying data-base I am seeing that > > Cayenne > > >> is > > >>> not automatically picking up that the underlying data is now > > inconsistant > > >>> and not reloading. Is there some way I can config Cayenne to > aggressive > > >>> check some tables for updates while ignoring others? > > >>> > > >>> Thanks a Million > > >>> Anthony Brew > > >>> > > >> > > > > >