Also note that memcache pickles your entity automatically and unpickles it
when you hit the cache. Pickling is dead slow in python so you are basically
trading off CPU for DatastoreCPU time. You might want to look into custom
pickling of your entities to make it more efficient to rebuild them when
they are fetched from memcache.

On Sat, Apr 4, 2009 at 1:14 PM, 秦锋 <feng.w....@gmail.com> 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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to