rem: int             status, new, timeout; Value   	   *vPtr; Ns_Entry       *ePtr; Ns_Cache	   *cache;
add: int             status = NS_FALSE, new, timeout; Value   	   *vPtr  = NULL; Ns_Entry       *ePtr  = NULL; Ns_Cache	   *cache = NULL;
context: DnsGet(GetProc *getProc, Ns_DString *dsPtr, Ns_Cache **cachePtr, char *key){    int             status, new, timeout;    Value   	   *vPtr;    Ns_Entry       *ePtr;    Ns_Cache	   *cache;    time_t	    now;    /*     * Get the cache, if enabled.     */    Ns_MutexLock(&lock);    cache = *cachePtr;    timeout = cachetimeout;    Ns_MutexUnlock(&lock);    /*     * Call getProc directly or through cache.     */    if (cache == NULL) {        status = (*getProc)(dsPtr, key);    } else {	time(&now);	Ns_CacheLock(cache);	ePtr = Ns_CacheCreateEntry(cache, key, &new);	if (!new) {	    while (ePtr != NULL &&		    (vPtr = Ns_CacheGetValue(ePtr)) == NULL) {		Ns_CacheWait(cache);		ePtr = Ns_CacheFindEntry(cache, key);	    }	    if (ePtr == NULL) {	        status = NS_FALSE;	    } else if (vPtr->expires < now) {		Ns_CacheUnsetValue(ePtr);		new = 1;	    } else {		Ns_DStringAppend(dsPtr, vPtr->value);		status = NS_TRUE;	    }	}	if (new) {	    Ns_CacheUnlock(cache);	    status = (*getProc)(dsPtr, key);	    Ns_CacheLock(cache);	    ePtr = Ns_CacheCreateEntry(cache, key, &new);	    if (status != NS_TRUE) {		Ns_CacheFlushEntry(ePtr);	    } else {	    	Ns_CacheUnsetValue(ePtr);		vPtr = ns_malloc(sizeof(Value) + dsPtr->length);		vPtr->expires = now + timeout;		strcpy(vPtr->value, dsPtr->string);		Ns_CacheSetValueSz(ePtr, vPtr, 1);	    }	    Ns_CacheBroadcast(cache);	}	Ns_CacheUnlock(cache);    }    return status;}