[Opensrf-commits] r1211 - trunk/src/libopensrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 7 10:19:55 EST 2008
Author: erickson
Date: 2008-01-07 09:55:36 -0500 (Mon, 07 Jan 2008)
New Revision: 1211
Modified:
trunk/src/libopensrf/osrf_cache.c
Log:
repaired expire time logic to force use of the configured max if timeout is indefinite (0) or larger than max
Modified: trunk/src/libopensrf/osrf_cache.c
===================================================================
--- trunk/src/libopensrf/osrf_cache.c 2008-01-07 02:11:47 UTC (rev 1210)
+++ trunk/src/libopensrf/osrf_cache.c 2008-01-07 14:55:36 UTC (rev 1211)
@@ -35,16 +35,14 @@
if( !(key && obj) ) return -1;
char* s = jsonObjectToJSON( obj );
osrfLogInternal( OSRF_LOG_MARK, "osrfCachePut(): Putting object: %s", s);
- if( seconds < 0 ) seconds = _osrfCacheMaxSeconds;
-
- mc_set(_osrfCache, key, strlen(key), s, strlen(s), seconds, 0);
+ osrfCachePutString(key, s, seconds);
free(s);
return 0;
}
int osrfCachePutString( char* key, const char* value, time_t seconds ) {
if( !(key && value) ) return -1;
- if( seconds < 0 ) seconds = _osrfCacheMaxSeconds;
+ seconds = (seconds <= 0 || seconds > _osrfCacheMaxSeconds) ? _osrfCacheMaxSeconds : seconds;
osrfLogInternal( OSRF_LOG_MARK, "osrfCachePutString(): Putting string: %s", value);
mc_set(_osrfCache, key, strlen(key), value, strlen(value), seconds, 0);
return 0;
More information about the opensrf-commits
mailing list