It's been a few months since I attempted to cache as you're asking. When I tried it did not work on GAE though I'm not clear if that was a memcache+GAE bug or just my implementation. What I know you can do is cache things like this.
-------------------- def gaecache(table,row,criteria): """ Search database, with cache to memcache """ from google.appengine.api import memcache data = memcache.get(key) if data is None: selection = db(db[table][row]==criteria).select() data = selection.as_list(datetime_to_str=False) memcache.add(key,data,3600) -------------------- All this does is check for an item in memecache and if it doesn't exist perform the normal web2py select. The results of the select are returned as a list and inserted into memcache for 3600 seconds (set whatever value you want). The only catch to this is a .select() statement doesn't return a list normally so be aware that this will return a list and not a Rows object. I have defined something similar to this in one of my model files. That makes it easy to use normal DAL on some items and call this function for items you would like cached. On Aug 30, 2:23 pm, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com> wrote: > I quite use reference fields -- maybe thats the problem... > can this be cached the way select is? > > sth like > db.define_table("Topics", > Field("parent_id","reference Topics", label=T("Parent > Topic"), ), > Field("name", "string") > ) > > db.define_table("Examples", > Field("topic_id", db.Topics, label="Topic", ), > Field("lang_id", db.Languages,label="Language", ), > ) > > and I use > db.Language[example.lang_id] > or > db.Topics[ db.Topics[example.topic_id].parent_id ] > > On 30 Rugp, 18:01, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > It is slow. does it contain a lot of code or a lot of DB IO? I cannot > > say without looking at the code. > > > On Aug 30, 9:09 am, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com> > > wrote: > > > > Hello, > > > > I have my beta apphttp://code.google.com/p/code-by-example/ > > > onhttp://web2py-gae-test.appspot.com/ > > > > which seems to load quite > > > slowlyhttp://ftp.akl.lt/incoming/jurgio/gae-logs.png > > > > I also tried logs,http://ftp.akl.lt/incoming/jurgio/cbe.profile.txt > > > but don't see big problems (though i use profiling for the first > > > time..) > > > > *** > > > I recently made KEEP_CACHED = True > > > > and for Session use Memcache > > > as I use session quite a bit > > > > but still can't feel that its better > > > > *** > > > I also see info in logs: > > > This request caused a new process to be started for your application, > > > and thus caused your application code to be loaded for the first time. > > > This request may thus take longer and use more CPU than a typical > > > request for your application. > > > > ***http://plugins.jquery.com/project/appear > > > might help me a bit, > > > as mostly used controller shows ~ 20% of what it loads > > > > I tried web2py_component(action,target) { > > > $('#'+target).appear(function() { > > > instead of > > > jQuery(document).ready(function(){ > > > but this did' t work :( > > > > any suggestions ?