Regarding the first problem you posted.
Try adding:

    def initialize(self):
        pass

in 
https://github.com/web2py/web2py/blob/master/gluon/contrib/memcache/__init__.py#L22

Let us know.
Paolo

On Friday, April 7, 2017 at 12:29:14 AM UTC+2, 黄祥 wrote:
>
> Tried to learn about memcache, create new web2py app from admin 
> *Situation 1 :*
> *models/db.py *
> ## memcache put on top of models/db.py
> # cache
> from gluon.contrib.memcache import MemcacheClient
> *memcache_servers = ['127.0.0.1:11211 <http://127.0.0.1:11211>']*
> *#memcache_servers = ['192.168.0.99:11211 <http://192.168.0.99:11211>']*
> cache.memcache = MemcacheClient(request, memcache_servers)
> cache.ram = cache.disk = cache.memcache
> # session
> from gluon.contrib.memdb import MEMDB
> session.connect(request, response, db = MEMDB(cache.memcache) ) 
>
> *Access :*
> https://server/a/appadmin/ccache
>
> *Error Traceback :*
> cache.ram.initialize()
> AttributeError: 'MemcacheClientObj' object has no attribute 'initialize'
>
> *Question 1 :*
> Is it normal or not about the traceback?
> *Question 2 :*
> Is it possible to use memcache on another machine? tried before but not 
> cached on another server, perhaps i missed something if it possible, any 
> hints?
>
> *Situation 2 :*
> *In terminal linux :*
> *# Display the current memory cache state*
> memcached-tool 127.0.0.1:11211 display
>
> *Result : *
>   #  Item_Size  Max_age   Pages   Count   Full?  Evicted Evict_Time OOM
>   8     480B        40s       1       1     yes        0        0    0
>
> *# Flush memcached*
> echo 'flush_all' | nc localhost 11211
>
> *Question :*
> Why after i flushed memcache, the web2py cache is still stored in 
> memcache? already tried to stop the web2py rocket server too, but same 
> result, is it normal or not?
>
> *Situation 3 :*
> Modified already built web2py app to use memcache
> *Error Traceback :*
> format = lambda r: '%s - %s - %s' % (r.name, r.supplier.name, 
> r.classification) )
> AttributeError: 'long' object has no attribute 'name'
>
> *solution 1 : *
> clean from web2py admin page, relogin, access the error page, the error 
> gone
> *solution 2 : *
> modified the code into 
> format = lambda r: '%s - %s' % (r.supplier.name, r.classification) )
>
> *Question :*
> why the same code is running well without using memcache?
>
> Thanks and Best Regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to