OK, I got an error, unknown global variable 'app' in gluon.contrib.memcache.__init__.py. Here are the proposed code fixes to memcache.__init__.py which I've tested locally and know to work:
Add this import at the top of the file: from gluon.cache import CacheAbstract In class _MemcacheClient(Client):, def__init__..., directly below "self.request=request" add: if request: app = request.application else: app = '' Thanks for all your help Massimo! With these fixes, I think we have the issue resolved. I will investigate adding Memcache stats to the appadmin controller as a separate task. On Jul 21, 10:53 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > Please try trunk again and let me know. > > On Jul 21, 9:11 am, Scott <blueseas...@gmail.com> wrote: > > > > > > > > > Massimo, > > > That fixed the " > > ValueError: invalid literal for int() with base 10: 'NOT_FOUND' " > > error for missing sessions. Thanks! > > > The " > > AttributeError: '_MemcacheClient' object has no attribute 'storage'" > > error remains. Maybe the code block and imports from gluon/cache.py > > need to be added to gluon/contrib/memcache/__init__.py? > > > if not app in self.meta_storage: > > self.storage = self.meta_storage[app] = > > {CacheAbstract.cache_stats_name: { > > 'hit_total': 0, > > 'misses': 0, > > }} > > > On Jul 21, 8:43 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > I do not remember who wrote that code but I just looked at it and I am > > > bit confused by it. > > > Anyway, I think I have a fix. Please try replace gluon/contribmemcache/ > > > memcache.py with this file: > > > >http://web2py.googlecode.com/hg/gluon/contrib/memcache/memcache.py > > > > Massimo > > > > On Jul 21, 7:27 am, Scott <blueseas...@gmail.com> wrote: > > > > > I'm running Ubuntu 10.04 and installed memcached which works fine > > > > locally. I installed the web2py stable 1.84.1 build and the stable > > > > wiki plugin from web2py.com. I followed the instructions > > > > at:http://web2py.com/book/default/section/11/12tostorethesessions in > > > > memcache for the provided Welcome app. Specifically, I created the > > > > 0_memcache.py model as instructed and I've tried adding the lines: > > > > > from gluon.contrib.memdb import MEMDB > > > > session.connect(request,response,db=MEMDB(cache.memcache)) > > > > > to either db.py or 0_memcache.py. In either case, when I load the > > > > welcome app, the following ticket is generated: > > > > > Traceback (most recent call last): > > > > File "/home/scott/Projects/web2py/gluon/main.py", line 391, in > > > > wsgibase > > > > session._try_store_in_db(request, response) > > > > File "/home/scott/Projects/web2py/gluon/globals.py", line 361, in > > > > _try_store_in_db > > > > record_id = table.insert(**dd) > > > > File "/home/scott/Projects/web2py/gluon/contrib/memdb.py", line 256, > > > > in insert > > > > id = self._create_id() > > > > File "/home/scott/Projects/web2py/gluon/contrib/memdb.py", line 291, > > > > in _create_id > > > > id = self._tableobj.incr(shard_id) > > > > File "/home/scott/Projects/web2py/gluon/contrib/memcache/ > > > > memcache.py", line 404, in incr > > > > return self._incrdecr("incr", key, delta) > > > > File "/home/scott/Projects/web2py/gluon/contrib/memcache/ > > > > memcache.py", line 428, in _incrdecr > > > > return int(line) > > > > ValueError: invalid literal for int() with base 10: 'NOT_FOUND' > > > > > Suggestions are welcome!