If you're trying to persist sessions per user across the datastore, gaeutilities already has a class you can use for that which uses both memcache and the datastore. Reads go to memcache first and then to the datastore if it's not found in memcache (memcache can't be trusted to be persistent).
If you're looking for something which can store data for all sessions, gaeutilities also has cache, which uses the same memcache/datastore logic. It also allows you to set expiration dates on the individual cache items. These cache items are accessible by all requests. Both use standard Python dictionary methods for access session['user'] = "bob" cache['myhit'] = "hit" Both also support storage of any object that can be pickled, so you can store dictionaries, lists, and such. http://gaeutilities.appspot.com/ On Oct 31, 1:43 pm, sal <[EMAIL PROTECTED]> wrote: > Nikola - thanks much for your input, I've been researching this for a > day or so now... and have found some things out in case anyone else is > wondering also. > > It looks like you can declare 'global' variables, and they stay in the > server's memory across all HTTP requests. I've created a hashmap > (err... what was the python version again? dict? :) I'm a J2EE guy) > and am using this to store a map of session cookies to the user's > requests, so I have now a working session. > > I still don't know how long the data in these global variables will > persist, or how much memory I have allocated to use, and I'm only > working locally on the SDK so I haven't tested on GAE yet. I am > planning to extend the session manager I created to work with memcache > and datastore to automatically persist sessions if/when I do find out > the real limits. > > The other question still open - is if GAE will be splitting multiple > HTTP requests over multiple copies of my 'in memory globals' > simultaneously... this will cause some more issues to work around... > if anyone has experience with this yet do let me know!! > > Thanks, > > On Oct 31, 7:52 am, Nikola <[EMAIL PROTECTED]> wrote: > > > GAE has no "global memory" - every handler runs in it's own address > > space. You can persist data in the datastore (perhaps caching with > > memcache for performance), or in browser cookies. A lot of > > applications can do with the Users API instead of full-blown sessions. > > > -Nikola > > > On Oct 30, 10:11 pm, sal <[EMAIL PROTECTED]> wrote: > > > > I tried to RTFM a bit on the topic and wasn't able to find what was > > > needed - if someone with more App Engine experience could point me in > > > the right direction that would be great! > > > > I understand that any cloud computing environment needs to allow for > > > dynamic allocation of computing resources - I am just looking to > > > discover what some of the operating parameters are so I can avoid > > > errors with my apps. My questions: > > > > - Regarding the behavior of regular python data structures: Assume I > > > have an object (an instance of a class) in global memory (for > > > performance reasons) which contains various fields holding values. > > > How long will a single user's web requests hit the same instance of > > > that object? Will multiple requests ever go to different 'cached' > > > instances of that object or another instance of that in-memory data > > > structure located on a different server? Do I need to anticipate > > > requests coming from the same user going to different web servers that > > > have independant cached versions of my application's data structures, > > > simultaneously? > > > > - How much 'memory' or 'ram' (Regular python memory') can I consume > > > via my python code... in the form of lists, Strings, dicts, etc. > > > before I encounter an exception? Is the limit per-user-session or per- > > > app? > > > > - I noticed from limited testing that there is at least a small > > > semblance of a session... what is the token used to arrbitrate them? > > > ie: does GAE use a browser cookie, the IP of the user - or a cookie > > > containing the user id? (I want to make sure that I don't invalidate > > > whatever the mechanic is, so I don't destroy the user's sessions) > > > > I'll try to keep searching documentation for some answers... if anyone > > > can point me to any info in the right direction I *greatly* > > > appreciate, in advance, all your help, > > > > - Sal > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
