function cache_get_cached_version ($id) {
  // HACK: Ignore memory requests if our OS doesn't
  // support memory functions
  if($id[0] == 'M' && !function_exists('shmop_open')) {
    $id[0] = 'F';
    }
  // Determine where we should dispatch the call
  switch ($id[0]) {
    case 'F' :
      // This item was cached via file
      $cache = cache_disk_get_cached_version ($id);
      break;
    case 'M' :
      // This item was cached via shared memory
      $cache = cache_shm_get_cached_version ($id);
      break;
    default :
      // Nothing useful... raise an error and bail out
      user_error("Unknown cache ID token '{$id}'", E_ERROR);
      die();
    }
  if ($cache && is_array($cache) && count($cache)==2)) {
    // Now that we have the cached object,
    //let's make sure that it's still good
    if ($cache[0] <= time()) { // -- ERREUR -- : c'est l'inverse, sinon le fichier n'expirera pas 
	// une fois la constante CACHE_TIMEOUT dépassée => if ($cache[0] >= time()) {
      return $cache[1];
    } else {
      return false;
      }
  } else {
    return false; // The cache failed
    }
  }
 
function cache_cache ($id, $value, $timeout){
  // Prepare cache
  $cache = array (time() + $timeout, $value);
  // HACK: Ignore memory requests if our OS doesn't
  // support memory functions
  if ($id[0] == 'M' && !function_exists('shmop_open')) {
    $id[0] = 'F';
    }
  // Determine where we should dispatch the call
  switch ($id[0]) {
    case 'F' :
      return cache_disk_cache ($id, $value);
    case 'M' :
      return cache_shm_cache ($id, $value);
    default :
      // Nothing useful... raise an error and bail out
      user_error("Unknown cache ID token '{$id}'", E_ERROR);
      die();
    }
  }

Design web agency 1max2web   NTIC web agency 1max2web