Yeah, wouldn't hurt to have a record of this case. Maybe we'll come up with some solution, or at least do a bit more testing.

Andrus

On May 20, 2010, at 3:22 PM, Gary Jarrel wrote:

Yes this was in fact the case, works fine with in memory caching.

Should I still lodge a ticket?

G

On Thu, May 20, 2010 at 6:14 PM, Andrus Adamchik <[email protected] > wrote:
One thing to keep in mind here is that OSQueryCacheFactory is not tested with persistent cache... It works perfect with in-memory cache, but I always thought that persisting the data that is sort of already persisted in the DB
doesn't buy us much, so that scenario never got any attention. E.g. I
wouldn't be surprised if de-serialization of the cache causes even more
issues.

Andrus


On May 20, 2010, at 10:03 AM, Andrey Razumovsky wrote:

Looks like a bug. Could you please open a ticket?

2010/5/20 Gary Jarrel <[email protected]>

Hi,
I managed to get the cache issue described below resolved, my error
with the DataContextFilter that I was using and it was overwriting the
modeler configuration when initializing shared config.

I've ran into another issue with the following code:

SelectQuery q = proto.queryWithParameters(params);
q.addPrefetch(RichProduct.MANUFACTURER_PROPERTY);
q.addPrefetch(RichProduct.RAW_PRODUCT_PROPERTY);
q.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
q.setCacheGroups("products");

Upon execution of this query I get the following exception:

ERROR com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache
[oscache] Exception persisting RichProduct/subCategory =
<ObjectId:SubCategory, category_id=1,
id=1>/categoryName/subCategoryName/cost
com .opensymphony.oscache.base.persistence.CachePersistenceException:
Unable to write
'/tmp/cache/application/ 0/0/5/005126BC80FABAA4C582919EDF0B9304.cache'
in the cache. Exception: java.io.NotSerializableException, Message:
org.apache.cayenne.access.ListWithPrefetches
     at

com .opensymphony .oscache .plugins .diskpersistence .AbstractDiskPersistenceListener .store(AbstractDiskPersistenceListener.java:376)
     at

com .opensymphony .oscache .plugins .diskpersistence .AbstractDiskPersistenceListener .store(AbstractDiskPersistenceListener.java:238)

<rest of stack trace removed>

If I however remove the prefetches then the caching works fine.

Looking at the source code for ListWithPrefetches it does not
implement Serializable, could this be the reason for it, or am I
missing something!

Thank you

Gary

On Wed, May 19, 2010 at 6:17 PM, Gary Jarrel <[email protected]>
wrote:

Hi Guys,
I seem to full of questions today!
In the modeler I've got org.apache.cayenne.cache.OSQueryCacheFactory for

Query Cache Factory, 5000 objects and using shared cache.

I can see OSCache initializing in the logs and everything appears to be

fine.

However when I try to get the cache from the ObjectContext like so: QueryCache cache = ((BaseContext) getObjectContext()).getQueryCache();
The cache that is being returned is

the org.apache.cayenne.cache.MapQueryCache

I've traced the calls and can see that the call got getQueryCache() goes

to MapQueryCacheFactory despite the fact that the modeler
specifies OSQueryCacheFactory

Am I doing something wrong here?
Thank you
Gary




--
Andrey




Reply via email to