developer.jelix.org is not used any more and exists only for
history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
Ticket #1237: ticket_1237.diff
File ticket_1237.diff, 1.5 KB (added by bricet, 10 years ago) |
---|
-
lib/jelix/utils/jCache.class.php
diff -r 37aa39f7ca6c lib/jelix/utils/jCache.class.php
a b 163 163 if($drv->enabled){ 164 164 165 165 $key = md5(serialize($fn).serialize($fnargs)); 166 $lockKey = $key.'_callLock'; 167 168 //wait lock to be realesed (if a lock exists) 169 $lockTests=0; 170 while( $drv->get($lockKey) ) { 171 usleep(100000); 172 if( ($lockTests++)%10 == 0 ) { //every second, first shot is on first call 173 //automatic cleaning cache 174 if($drv->automatic_cleaning_factor > 0 && rand(1, $drv->automatic_cleaning_factor) == 1){ 175 $drv->garbage(); 176 } 177 } 178 } 166 179 167 180 if (!($data = $drv->get($key))) { 168 181 182 $lockTtl = get_cfg_var('max_execution_time'); 183 if( !$lockTtl ) { 184 $lockTtl = $drv->ttl; 185 } 186 $lockTtl = max( 30, min( $lockTtl, $drv->ttl ) ); //prevent lock ttl from being more than drv's ttl and from being eternal 187 $drv->set($lockKey,true,$lockTtl); 188 169 189 $data = self::_doFunctionCall($fn,$fnargs); 170 190 171 191 if (!is_resource($data)) { … … 184 204 $drv->set($key,$data,$ttl); 185 205 } 186 206 } 207 $drv->delete($lockKey); 187 208 } 188 209 189 210 return $data;