You need to do both. Memcache doesn't persist. 2009/4/4 秦锋 <[email protected]>
> > Thanks! > Does it means I have to put entity back to db or pickle it back to > memcache after changed something? Otherwise changes will be lost, I > guess. > > On 4月4日, 下午9时31分, Tim Hoffman <[email protected]> wrote: > > That is correct, an instance is being recreated from the data stored > > in memcache > > > > You will find the same value inside it though. > > > > What happens is the object is being pickled when you stick it into > > memcache, when you get it the object it > > is unpickled and essentially a new instance is created from the data > > stored. > > > > T > > > > On Apr 4, 7:14 pm, 秦锋 <[email protected]> wrote: > > > > > > > > > Following is my code in interactive console in local SDK admin web > > > page: > > > > > from google.appengine.api import memcache > > > from google.appengine.ext import db > > > > > r = db.Model() > > > memcache.set("Mytest", r) > > > > > i = 0 > > > while i<10: > > > print memcache.get("Mytest") > > > i+=1 > > > > > When I run it, I got different instances for the same key? Is it > > > wrong? > > > > > <google.appengine.ext.db.Model object at 0x024DCFF0> > > > <google.appengine.ext.db.Model object at 0x024DCE10> > > > <google.appengine.ext.db.Model object at 0x024DCDD0> > > > <google.appengine.ext.db.Model object at 0x024DCF50> > > > <google.appengine.ext.db.Model object at 0x024DCFF0> > > > <google.appengine.ext.db.Model object at 0x024DCE10> > > > <google.appengine.ext.db.Model object at 0x024DCDD0> > > > <google.appengine.ext.db.Model object at 0x024DCF50> > > > <google.appengine.ext.db.Model object at 0x024DCFF0> > > > <google.appengine.ext.db.Model object at 0x024DCE10> > > > -- Alkis --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en -~----------~----~----~----~------~----~------~--~---
