Doctrine\Common\Cache\CacheProvider::setNamespace PHP Метод

setNamespace() публичный Метод

Sets the namespace to prefix all cache ids with.
public setNamespace ( string $namespace ) : void
$namespace string
Результат void
    public function setNamespace($namespace)
    {
        $this->namespace = (string) $namespace;
        $this->namespaceVersion = null;
    }

Usage Example

Пример #1
0
 private function init($namespace)
 {
     $prefix = self::$namespacePrefix;
     $namespace = "{$prefix}:{$namespace}";
     $type = 0;
     if (static::$TYPE_PREFER_DEFAULT == 0) {
         if (isset(static::$_TYPE)) {
             $type = static::$_TYPE;
         } else {
             $type = static::$TYPE_DEFAULT;
         }
     } else {
         $type = static::$TYPE_PREFER_DEFAULT;
     }
     if ($type == static::$TYPE_APC) {
         $this->_cacheImplement = new ApcCache();
     } else {
         if ($type == static::$TYPE_MEMCACHE) {
             $m = new MemcacheCache();
             $memcache = new \Memcache();
             $memcache->connect('localhost', 11211);
             $m->setMemcache($memcache);
             $this->_cacheImplement = $m;
         } else {
             if ($type == static::$TYPE_XCACHE) {
                 $this->_cacheImplement = new XcacheCache();
             } else {
                 $this->_cacheImplement = new ArrayCache();
             }
         }
     }
     $this->_cacheImplement->setNamespace($namespace);
 }
All Usage Examples Of Doctrine\Common\Cache\CacheProvider::setNamespace