This code works:
for num in range(1,4):
results = memcache.get("link_" + str(num))
output.write('An anonymous person wrote: <blockquote>%s</blockquote>' % results.date)
return output.getvalue()
This code is not working:
results = memcache.get_multi(linkKeys,"link_")
for results in results:
output.write('An anonymous person wrote: <blockquote>%s</blockquote>' % results.date)
return output.getvalue()
Can someone explain to me why using memcache.get_multi returns the error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 515, in __call__
handler.get(*groups)
File "C:\Main.py", line 28, in get
values.write(self.RenderValue())
File "C:\Main.py", line 57, in RenderValue
output.write('An anonymous person wrote: <blockquote>%s</blockquote>' % results.date)
AttributeError: 'str' object has no attribute 'date'
Thanks to anyone that helps me solve this problem!
对于result * s *在result * s * ??中
memcache can only store pickleable objects. Can you safely pickle a GqlQuery
result? If not, you may need to convert it to a dict
first before handing it off to memcache.
See the pickle docs and probably the relevant GAE docs.
You may also want to benchmark this and see if using memcache is really helping.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.