def lazy_cache(key=None, time_expire=None, cache_model='ram'):
 def decorator(f, key=key, time_expire=time_expire, cache_model=cache_model):
  key = (key or repr(f))
  def g(*c, **d):
   from gluon import current
   return current.cache(key, time_expire, cache_model)(f)(*c, **d)
  g.__name__ = f.__name__
  return g
 return decorator

def lazy_cache ( key = None , time_expire = None , cache_model = 'ram' ) : def decorator ( f , key = key , time_expire = time_expire , cache_model = cache_model ) : key = ( key or repr ( f ) ) def g ( * c , ** d ) : from gluon import current return current . cache ( key , time_expire , cache_model ) ( f ) ( * c , ** d ) g . __name__ = f . __name__ return g return decorator
can be used to cache any function including ones in modules .