(couch_cls, obj_id, prop_name, expiry=12*60*60)
return ret
A function that returns a property of any couch object. If it doesn't find the property in memcached, it does
        the couch query to pull the object and grabs the property. Then it caches the retrieved property.
        Note: The property needs to be pickleable
A function that returns a property of any couch object. If it doesn't find the property in memcached, it does
        the couch query to pull the object and grabs the property. Then it caches the retrieved property.
        Note: The property needs to be pickleable
A function that returns a property of any couch object . If it doesn t find the property in memcached it does the couch query to pull the object and grabs the property . Then it caches the retrieved property . Note : The property needs to be pickleable
def get_cached_property(couch_cls, obj_id, prop_name, expiry=12*60*60):
    """
        A function that returns a property of any couch object. If it doesn't find the property in memcached, it does
        the couch query to pull the object and grabs the property. Then it caches the retrieved property.
        Note: The property needs to be pickleable
    """
    from django.core.cache import cache
    cache_str = "{0}:{1}:{2}".format(couch_cls.__name__, obj_id, prop_name)
    ret = cache.get(cache_str)
    if not ret:
        data = couch_cls.get_db().get(obj_id)
        if couch_cls._doc_type in [data.get("doc_type"), data.get("base_doc")]:
            obj = couch_cls.wrap(data)
            ret = getattr(obj, prop_name)
            cache.set(cache_str, ret, expiry)
        else:
            raise IncompatibleDocument("The retrieved document doesn't match the Document Class provided")
    return ret
def get_cached_property ( couch_cls , obj_id , prop_name , expiry = 12 * 60 * 60 ) : from django . core . cache import cache cache_str = "{0}:{1}:{2}" . format ( couch_cls . __name__ , obj_id , prop_name ) ret = cache . get ( cache_str ) if not ret : data = couch_cls . get_db ( ) . get ( obj_id ) if couch_cls . _doc_type in [ data . get ( "doc_type" ) , data . get ( "base_doc" ) ] : obj = couch_cls . wrap ( data ) ret = getattr ( obj , prop_name ) cache . set ( cache_str , ret , expiry ) else : raise IncompatibleDocument ( "The retrieved document doesn't match the Document Class provided" ) return ret