i did some grepping of my code and found some things....

 - it seems that cache.ram is automatically set to GAE memcache when you 
are using GAE.  it's part of the GAE setup web2py does for you.
 - the code above looks OK for storing sessions in memcache.  FWIW, I gave 
up using memcache for sessions because the eviction time was too short for 
my need on GAE (about 5 mins was the best i could get)

I am using memcache on GAE quite a bit, so it for sure can work.  Can you 
post the stack trace from the GAE logs (SDK or production) that you are 
seeing?

thanks,

cfh

On Thursday, February 14, 2013 2:33:37 AM UTC-8, Andy W wrote:
>
> I would like to store both session data and cached data in memcache when I 
> upload my app to GAE. Can anybody point me in the right direction for 
> setting this up?
>
> Based on the web2py scaffolding app I have tried (in models/db.py):
>
> if not request.env.web2py_runtime_gae:
>     db = DAL('sqlite://storage.sqlite', lazy_tables=True)
> else:
>     db = DAL('google:datastore', lazy_tables=True)
>     from gluon.contrib.memdb import MEMDB
>     from google.appengine.api.memcache import Client
>     session.connect(request, response, db = MEMDB(Client()))
>     cache.ram = cache.disk = cache.memcache
>
> My app runs OK on sqlite but, once moved to GAE I get an Internal Error 
> whenever serving a page that attempts to store cache data in memcache.
>
> From http://web2py.com/books/default/chapter/29/13?search=cache#MemcacheI see 
> there is a suggestion to use:
>
>     from gluon.contrib.gae_memcache import MemcacheClient
>     from gluon.contrib.memdb import MEMDB
>     cache.memcache = MemcacheClient(request)
>
> I don't understand how this relates to the scaffolding app code - what is 
> MEMDB, what is the correct usage of gluon.contrib.gae_memcache 
> and google.appengine.api.memcache?
>
> Trial and error has got me nowhere, so I thought I would confess my 
> ignorance and ask the experts!
>
> Andy
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to