GAE is single thread server.
On Dec 2, 2:50 am, "Sharp-Developer.Net"
<[EMAIL PROTECTED]> wrote:
> Would not be that thread unsafe?
>
> As I understand modules are loaded once per machine instance and then
> cached/reused by different requests.
>
> I'm not sure what is the "__main__" module. I don't have such.
>
> So I afraid if I cache in module user specific information it will
> become visible to another thread of my app running on the same box.
> --
> Alexander Trakhimenokhttp://sharp-developer.net/
>
> On Dec 2, 2:04 am, yejun <[EMAIL PROTECTED]> wrote:
>
> > For example,
>
> > import __main__
>
> > class yourhandler(webapp.RequestHandler):
> > def __init__():
> > __main__.cache = {}
>
> > On Dec 1, 9:00 pm, yejun <[EMAIL PROTECTED]> wrote:
>
> > > You can save it to a global variable as cache.
> > > You can use a module level variable as cache and clear it in the
> > > handler's __init__.
>
> > > On Dec 1, 2:28 pm, "Sharp-Developer.Net"
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hi,
>
> > > > I have to retrieve some entities by key multiple times during single
> > > > request.
>
> > > > I do use memcache but getting quite high CPU usage and lot's of
> > > > warnings.
>
> > > > As I retrieve the same entity by it key multiple (many) times during a
> > > > request I wonder could I improve my code by caching results on per
> > > > request handler instance basis? I sure I could but as newbie in Python
> > > > I'm not sure what is the best place & way to do that.
>
> > > > I could add variable to a request object (I use Django) but that will
> > > > require to pass it to every place where I need to use it. It's too
> > > > complicated.
>
> > > > I wonder is there such a thing like a HttpContext.Current in C#? In
> > > > ASP.NET if I want to store/retrieve an object on per request basis
> > > > I'll simply do next:
>
> > > > HttpContext.Current.Items["key"] = value;
> > > > var value = HttpContext.Current.Items["key"];
>
> > > > Is the anything similar in AppEngine/Python?
>
> > > > Again, as a Python newbie will apreciate a working code sample.
>
> > > > I think this question could be interesting to many people.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---