Be aware that the value of a global variable is not known at the start
of a request.
It could be the value from the previous request if the interpreter was
already warm/running.
It would be the initial value if the interpreter was started cold.
Why not put the GQL object in the request handler
The advantage of caching GqlQuery objects between requests is that it saves
on having to compile the GQL for future requests. By storing it in a global
and binding new values prior to calling, it gets compiled on the first
request for the web server instance, and uses the pre-compiled version on
hi alex! you're right to be cautious, but happily, requests are not
handled by different threads. our python interpreters are single
threaded, and handle only a single request at a time. more:
http://code.google.com/appengine/docs/python/sandbox.html
Ah, I see. It's safe because a new request will not be processed by
the same instance of the python interpreter until the previous request
has fully completed, right?
Thanks, Ryan!
On Dec 16, 7:37 pm, Ryan Barrett goo...@ryanb.org wrote:
hi alex! you're right to be cautious, but happily,