(db, doc_id, cache_expire=COUCH_CACHE_TIMEOUT, **params)
Main wrapping function to open up a doc. Replace db.open_doc(doc_id)
Main wrapping function to open up a doc. Replace db.open_doc(doc_id)
Main wrapping function to open up a doc . Replace db . open_doc ( doc_id )
def cached_open_doc(db, doc_id, cache_expire=COUCH_CACHE_TIMEOUT, **params):
    """
    Main wrapping function to open up a doc. Replace db.open_doc(doc_id)
    """
    try:
        cached_doc = _get_cached_doc_only(doc_id)
    except ConnectionInterrupted:
        cached_doc = INTERRUPTED
    if cached_doc in (None, INTERRUPTED):
        doc = db.open_doc(doc_id, **params)
        if cached_doc is not INTERRUPTED:
            do_cache_doc(doc, cache_expire=cache_expire)
        return doc
    else:
        return cached_doc
def cached_open_doc ( db , doc_id , cache_expire = COUCH_CACHE_TIMEOUT , * * params ) : try : cached_doc = _get_cached_doc_only ( doc_id ) except ConnectionInterrupted : cached_doc = INTERRUPTED if cached_doc in ( None , INTERRUPTED ) : doc = db . open_doc ( doc_id , * * params ) if cached_doc is not INTERRUPTED : do_cache_doc ( doc , cache_expire = cache_expire ) return doc else : return cached_doc