Remember only things in the datastore and memcache are truly global Also remember that any instance can disappear and anything you define specific to an instance (traditional global variables) will be invisible to all other instances. If its value is out of date you will find it difficult to know its has changed,
One place to stick values is in the request object (then its specific to the request being processed by the current instance) or in a session. Based on what you described fetching something once from memcache at the beginning of the request and then caching the value in the request would make the most sense. Rgds T On Jul 22, 3:06 pm, Bill Edwards <[email protected]> wrote: > Hi guys, > > The question I have is: If I do a query within a Python class object, > what is the easiest way to make the query results available globally > (in other class objects and template filter functions)? > > I'm finding that different objects in one of my handlers are making > the same memcache calls. Is it bad to make the > results of a memcache call a global variable so that any object can > access it? or is there an easier way to do this? > > The specific example is I need to fetch the category slug given a > category name multiple times in one handler but each time i need to > fetch this info from the memcache, it's in a different object's scope, > so the values from the last query aren't in the same scope. When i > first make the memcache call in a member function of object1, i want > to store it as a global variable so that when i need to make the same > memcache call in member function of object2, i dont have to do hit > memcache again. > > Thanks! -- 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.
