Hello,

I'm working on a new Java App Engine application; this application
will have mostly read-only data, but once in a while it will have to
update a large number of entities which depend on each other in
various ways. To avoid doing countless queries on the same objects,
I'm using memcache to quickly retrieve data that has already been
queried.

In general, I've seen in samples that memcache is used as a caching
layer for data retrieval (e.g. user wants to see information and
information is cached); I think I am trying something different here
(I need to update object and object is cached) - it might be wrong but
I can't really tell why.

The steps that I perform are as follows:
1. I need to update entity X. I determine that I also need information
from entity Y to do that, so I retrieve and cache Y.
2. I update X, make it persistent and cache it.
3. At a later point, I might need to update Y, so I first look it up
in the cache, find it, update it and persist it.

I only add to the cache objects obtained from a query (I don't cache
any objects created with application logic and not backed by the
datastore). It seems there is something wrong with my approach, as
persisting Y in step 3 seems to append data to the existing object in
the datastore instead of replacing it. It could also mean that I'm
missing completely some important aspects of using the datastore /
memcache. In either case, if someone could point out what I'm doing
wrong, I'll be forever grateful.

Thanks,
Adrian B

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to