[google-appengine] Re: What is a proper way to cache values on per request basis?

2008-12-02 Thread yejun
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

[google-appengine] Re: What is a proper way to cache values on per request basis?

2008-12-01 Thread Joel Odom
Try getting rid of the memcache in favor of a hard-coded value (for testing purposes only). If you're still getting high CPU usage, then the problem is not with your use of memcache. You can also use global variables to cache values, as long as you're careful. On Mon, Dec 1, 2008 at 2:28 PM,

[google-appengine] Re: What is a proper way to cache values on per request basis?

2008-12-01 Thread Sharp-Developer.Net
Ok, may be the problem was in json serialization/deserialization. But I'm learning the Python/GAE and still eager to get answer to my question regarding how to store some values accessible throug out request without passing them through out all my layers. Any help? -- Alex

[google-appengine] Re: What is a proper way to cache values on per request basis?

2008-12-01 Thread yejun
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

[google-appengine] Re: What is a proper way to cache values on per request basis?

2008-12-01 Thread yejun
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