web2py has a built-in caching mechanism but, since version 1.26, it also includes the memcache client ftp://ftp.tummy.com/pub/python-memcached/
Assuming memcache is running on locahost on port 11211, somewhere in your code, before you use it, do
from gluon.contrib.memcache import MemcacheClient
memcache_servers=['127.0.0.1:11211']
cache.mem=MemcacheClient(request,memcache_servers)
then use cache.mem instead of cache.ram and cache.disk according to the caching examples.
Support for memcache is "experimental", so please let us know if it works.