def get_object(model, cid, engine_name=None, connection=None):
    """
    Get cached object from redis
    
    if id is None then return None:
    """
    from uliweb import settings
    
    if not id:
        return 
    
    if not check_enable():
        return
    
    redis = get_redis()
    if not redis: return

    tablename = model._alias or model.tablename
    
    info = settings.get_var('OBJCACHE_TABLES/%s' % tablename, {})
    if info is None:
        return
    
    _id = get_id(engine_name or model.get_engine_name(), tablename, cid)
    try:
        log.debug("Try to find objcache:get:table=%s:id=[%s]" % (tablename, _id))
        if redis.exists(_id):
            v = redis.hgetall(_id)
            o = model.load(v, from_='dump')
            log.debug("Found!")
            return o
        else:
            log.debug("Not Found!")
    except Exception as e:
        log.exception(e)
def get_object ( model , cid , engine_name = None , connection = None ) : from uliweb import settings if not id : return if not check_enable ( ) : return redis = get_redis ( ) if not redis : return tablename = model . _alias or model . tablename info = settings . get_var ( 'OBJCACHE_TABLES/%s' % tablename , { } ) if info is None : return _id = get_id ( engine_name or model . get_engine_name ( ) , tablename , cid ) try : log . debug ( "Try to find objcache:get:table=%s:id=[%s]" % ( tablename , _id ) ) if redis . exists ( _id ) : v = redis . hgetall ( _id ) o = model . load ( v , from_ = 'dump' ) log . debug ( "Found!" ) return o else : log . debug ( "Not Found!" ) except Exception as e : log . exception ( e )
Get cached object from redis
    
    if id is None then return None: