From: erickson Date: Mon, 7 Jan 2008 14:55:36 +0000 (+0000) Subject: repaired expire time logic to force use of the configured max if timeout is indefinit... X-Git-Tag: osrf_rel_2_0_1~756 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=224d1833a4e07c4319e2c5127c616e54fe4250f6;p=OpenSRF.git repaired expire time logic to force use of the configured max if timeout is indefinite (0) or larger than max git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1211 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libopensrf/osrf_cache.c b/src/libopensrf/osrf_cache.c index 2cd52b1..389add1 100644 --- a/src/libopensrf/osrf_cache.c +++ b/src/libopensrf/osrf_cache.c @@ -35,16 +35,14 @@ int osrfCachePutObject( char* key, const jsonObject* obj, time_t seconds ) { 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;