A snippet from the code for google.appengine.api.users ---------- A nickname is a human-readable string which uniquely identifies a Google user, akin to a username. It will be an email address for some users, but not all. --------- At the moment the __str__() functions returns the User.nickname(). And that makes your memcache key unique for the current user. And when there is no logged in user you get the key 'RegistrationNone'
2009/1/1 Toney <[email protected]>: > > your correct about the quotes I did make a mistake when retyping the > code. > > with the users.get_current_user() object what if I concatenated the > key as such... > query = memcache.get('Registration'+str(users.get_current_user())) > > i'm not getting an error when I do it this way but i'm not sure if > doing it this way is a good idea > > On Dec 31, 12:22 pm, djidjadji <[email protected]> wrote: >> There is NO difference, only the first names the individual arguments, >> you can call >> memcache.add(time=3600, value=query >> ,key="Registration'+users.get_current_user()" ) >> and get the same result. >> The second versions uses the position of the arguments. >> >> I noticed some strange things with the quotes, single and double, are >> they exactly as given in the examples? >> users.get_current_user() returns a User object, this might not work >> very well in adding to a String unless Python calls the __str__() >> method on the User object because we try to add to a string. >> >> 2008/12/31 Toney <[email protected]>: >> >> >> >> > I'm optimizing my code to use memcache, can anyone tell me the >> > difference between using memcache like this... >> >> > memcache.add(key="Registration'+users.get_current_user()", >> > value=query, time=3600) >> >> > versus this way... >> >> > memcache.add('Registration'+users.get_current_user(), query >> >> > I found one way while watching the building-scalable-web-applications- >> > with-google-app-engine video and the other in the memcache >> > documentation. >> >> > I'm thinking the second example appends data to the memcachce key and >> > the first replaces what's in the specific memcache key with the new >> > value. or is there no difference?? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
