public function put($obj_name, $obj, $expiry = NULL)
 {
     if ($expiry == NULL) {
         $expiry = $this->m_expiry;
     }
     sfProcessCache::set($this->m_namespace . $obj_name, $obj, $expiry);
     // TODO - maintain the linked_list
     //		//$this->m_obj_container[$obj_name] = $obj;
     $this->m_stats->m_puts++;
 }
 /**
  * @todo Should we throw an exception if the config value does not exist?
  */
 public static function getConfigValueFor($input)
 {
     $cache = sfConfig::get('app_phpbb_cache', false);
     if (!$cache) {
         $configValues = self::getConfigValues();
         if (isset($configValues[$input])) {
             return $configValues[$input];
         }
     }
     if ($cache) {
         $cacheKeyNonDynamic = 'config_values';
         $cacheKeyDynamic = 'config_values_dynamic';
         if (sfProcessCache::has($cacheKeyNonDynamic)) {
             $configValues = sfProcessCache::get($cacheKeyNonDynamic);
         } else {
             $configValues = self::getConfigValues(0);
             sfProcessCache::set($cacheKeyNonDynamic, $configValues, myTools::getConfig('app_cache_config_non_dynamic', 86400));
         }
         if (isset($configValues[$input])) {
             return $configValues[$input];
         }
         // Reset config values before we check dynamic config values
         unset($configValues);
         if (sfProcessCache::has($cacheKeyDynamic)) {
             $configValues = sfProcessCache::get($cacheKeyDynamic);
         } else {
             $configValues = self::getConfigValues(1);
             sfProcessCache::set($cacheKeyDynamic, $configValues, myTools::getConfig('app_cache_config_dynamic', 60));
         }
         if (isset($configValues[$input])) {
             return $configValues[$input];
         }
     }
     // If we get here, there is no config value for this input.
     return null;
 }
 public function set($key, $value, $expire = 0)
 {
     sfProcessCache::set($key, $value, $expire);
 }
Пример #4
0
/**
 * Returns a key which combined all assets file
 *
 * @return string md5
 */
function _get_key($files)
{
    $content = base64_encode(serialize($files));
    $key = md5($content . sfConfig::get('app_sfCombine_asset_version', ''));
    if (!class_exists('DbFinder')) {
        throw new Exception('sfCombine expects DbFinder to call combined asset file');
    }
    $keyExists = DbFinder::from('sfCombine')->where('AssetsKey', $key)->count();
    if (!$keyExists) {
        $combine = new sfCombine();
        $combine->setAssetsKey($key);
        $combine->setFiles($content);
        $combine->save();
    }
    // Checks if key exists
    if (!sfProcessCache::has($key)) {
        sfProcessCache::set($key, true);
    }
    return $key;
}