I found it ;)

http://groups.google.com/group/google-appengine/browse_frm/thread/51ed5014d6fced17/a7066e4c96d6196d

***************************************
Both are correct. When you call memcache.incr, it will try to
interpret the string value as an integer. That code pre-dates the
smart handling of integer, long, and boolean types. App Engine now
does this automatically under the covers. The upstream memcache Python
interface does not, as I understand it.
***************************************



On 9 juin, 20:45, Sylvain <[email protected]> wrote:
> I've already ask for this and the answer (in this group) from a
> Googler is now you can use both :
>
> memcache.add(name, str(total), 60)
> or
> memcache.add(name, total, 60)
>
> On 8 juin, 21:09, Wooble <[email protected]> wrote:
>
> > It's a requirement of memcached; the incr command in the underlying
> > protocol operates on a string it treats as an ASCII representation of
> > an integer.
>
> > I believe memcache stores everything as a string, although the library
> > has some magic in it to allow you to store any datatype it can pickle.
>
> > On Jun 8, 1:26 pm, Ethan Post <[email protected]> wrote:
>
> > > I am using the code found here.
>
> > >http://code.google.com/appengine/articles/sharding_counters.html
>
> > > Upon using this I noticed that it would return an int the first time and a
> > > str the second. Appears to be the way the value is being stored in 
> > > memcache.
> > > I change the line below and works as expected now.
>
> > >     # memcache.add(name, str(total), 60)
> > >     memcache.add(name, total, 60)
>
> > > Am I missing something here? Is there a reason str(total) would be 
> > > preferred
> > > over total?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to