def RedisCache(redis_conn=None, debug=False, with_lock=False, fail_gracefully=False, db=None):
 locker.acquire()
 try:
  instance_name = ('redis_instance_' + current.request.application)
  if (not hasattr(RedisCache, instance_name)):
   setattr(RedisCache, instance_name, RedisClient(redis_conn=redis_conn, debug=debug, with_lock=with_lock, fail_gracefully=fail_gracefully))
  return getattr(RedisCache, instance_name)
 finally:
  locker.release()

def RedisCache ( redis_conn = None , debug = False , with_lock = False , fail_gracefully = False , db = None ) : locker . acquire ( ) try : instance_name = ( 'redis_instance_' + current . request . application ) if ( not hasattr ( RedisCache , instance_name ) ) : setattr ( RedisCache , instance_name , RedisClient ( redis_conn = redis_conn , debug = debug , with_lock = with_lock , fail_gracefully = fail_gracefully ) ) return getattr ( RedisCache , instance_name ) finally : locker . release ( )
usage example: put in models:: first of all install redis ubuntu : sudo apt-get install redis-server sudo pip install redis then from gluon .