Hi John,

you mentioned about persisting the memcache counts periodically into
datastore. What's the best practice to do these periodical updates
let's say on a situation when the traffic is very volatile? I've
implemented Twig-persist into my project, so would you like to provide
some additional code for the example based on the Cookbook strategy,
http://code.google.com/p/twig-persist/wiki/Cookbook?

On Apr 8, 12:33 pm, John Patterson <jdpatter...@gmail.com> wrote:
> You will need to read and update the object in a transaction which  
> will throw an exception on commit if another thread updates the same  
> entity.  You can then refresh the object and try again.  Also look  
> into memcache which has an atomic counter increment method that is  
> much faster than reading and writing to the datastore.  The downside  
> is that the counts could be reset so you may need to periodically  
> store them in the datastore.
>
> On 8 Apr 2010, at 16:17, mscwd01 wrote:
>
> > Hey,
>
> > How do you ensure, once you have queried an object from the datastore,
> > that another call to that object cannot be made?
> > I basically have a bunch of objects with counters which get
> > incremented during each call to that object.
>
> > What I need to ensure is the object doesn't get called by two threads,
> > each of which increment the counter by 1 and persist the object back
> > to the datastore, only for the counter to be incremented by 1 and not
> > by 2.
>
> > Thanks
>
> > --
> > 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 google-appengine-java@googlegroups.com
> > .
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en
> > .

-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to