|
From: <gne...@us...> - 2009-01-31 22:16:45
|
Update of /cvsroot/aolserver/aolserver/nsd In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16532/nsd Modified Files: tclcache.c Log Message: - Fixed behavior such that 'return' in 'ns_cache eval' works like described in the documentation and in the old nscache module. - Added documentation of optional 'pattern' argument for 'ns_cache names'. Index: tclcache.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclcache.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tclcache.c 1 Aug 2005 20:29:24 -0000 1.2 --- tclcache.c 31 Jan 2009 21:35:08 -0000 1.3 *************** *** 392,395 **** --- 392,396 ---- return TCL_ERROR; } + status = TCL_OK; key = Tcl_GetString(objv[3]); Ns_CacheLock(cachePtr->cache); *************** *** 439,449 **** Ns_CacheLock(cachePtr->cache); entry = Ns_CacheCreateEntry(cachePtr->cache, key, &new); ! if (status != TCL_OK) { ! Ns_CacheFlushEntry(entry); ! err = 1; ! } else { objPtr = Tcl_GetObjResult(interp); valPtr = NewVal(cachePtr, objPtr, &now); Ns_CacheSetValueSz(entry, valPtr, valPtr->length); } Ns_CacheBroadcast(cachePtr->cache); --- 440,454 ---- Ns_CacheLock(cachePtr->cache); entry = Ns_CacheCreateEntry(cachePtr->cache, key, &new); ! ! if (status == TCL_OK || status == TCL_RETURN) { objPtr = Tcl_GetObjResult(interp); valPtr = NewVal(cachePtr, objPtr, &now); Ns_CacheSetValueSz(entry, valPtr, valPtr->length); + + if (status == TCL_RETURN) { + status = TCL_OK; + } + } else { + Ns_CacheFlushEntry(entry); } Ns_CacheBroadcast(cachePtr->cache); *************** *** 454,457 **** --- 459,464 ---- return TCL_ERROR; } + + return status; break; } |