Browse Source

Fixes #11560: Removed XCache and Zend data cache support as caching backends

tags/3.0.0-alpha1
Alexander Makarov 8 years ago
parent
commit
f3478bb59b
  1. 2
      .travis.yml
  2. 2
      docs/guide-es/caching-data.md
  3. 2
      docs/guide-ja/caching-data.md
  4. 4
      docs/guide-pt-BR/caching-data.md
  5. 2
      docs/guide-ru/caching-data.md
  6. 3
      docs/guide-zh-CN/caching-data.md
  7. 4
      docs/guide/caching-data.md
  8. 1
      framework/CHANGELOG.md
  9. 106
      framework/caching/XCache.php
  10. 2
      framework/classes.php
  11. 30
      tests/framework/caching/XCacheTest.php
  12. 30
      tests/framework/caching/ZendDataCacheTest.php

2
.travis.yml

@ -59,7 +59,7 @@ before_script:
script:
- vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,xcache,zenddata,cubrid
- vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,cubrid
after_script:
- |

2
docs/guide-es/caching-data.md

@ -79,8 +79,6 @@ se muestra un listado con los componentes de caché disponibles:
* [[yii\caching\MemCache]]: utiliza las extensiones de PHP [memcache](http://php.net/manual/es/book.memcache.php) y [memcached](http://php.net/manual/es/book.memcached.php). Esta opción puede ser considerada como la más rápida cuando la caché es manejada en una aplicación distribuida (ej. con varios servidores, con balance de carga, etc..)
* [[yii\redis\Cache]]: implementa un componente de caché basado en [Redis](http://redis.io/) que almacenan pares clave-valor (requiere la versión 2.6.12 de redis).
* [[yii\caching\WinCache]]: utiliza la extensión de PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension) ([ver también](http://php.net/manual/es/book.wincache.php)).
* [[yii\caching\XCache]]: utiliza la extensión de PHP [XCache](http://xcache.lighttpd.net/).
* [[yii\caching\ZendDataCache]]: utiliza [Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) como el medio fundamental de caché.
> Tip: Puedes utilizar diferentes tipos de almacenamiento de caché en la misma aplicación. Una estrategia común es la de usar almacenamiento de caché en memoria para almacenar datos que son pequeños pero que son utilizados constantemente (ej. datos estadísticos), y utilizar el almacenamiento de caché en archivos o en base de datos para guardar datos que son grandes y utilizados con menor frecuencia (ej. contenido de página).

2
docs/guide-ja/caching-data.md

@ -84,8 +84,6 @@ Yii はさまざまなキャッシュストレージをサポートしていま
分散型のアプリケーションでキャッシュを扱うときには最速の一つとして考えることができます (例えば、複数台のサーバで、ロードバランサがある、などの場合) 。
* [[yii\redis\Cache]]: [Redis](http://redis.io/) の key-value ストアに基づいてキャッシュコンポーネントを実装しています。(Redis の バージョン 2.6.12 以降が必要です) 。
* [[yii\caching\WinCache]]: PHP の [WinCache](http://iis.net/downloads/microsoft/wincache-extension) ([関連リンク](http://php.net/manual/ja/book.wincache.php)) 拡張モジュールを使用します。
* [[yii\caching\XCache]]: PHP の [XCache](http://xcache.lighttpd.net/) 拡張モジュールを使用します。
* [[yii\caching\ZendDataCache]]: キャッシュメディアして [Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) を使用します。
> Tip: 同じアプリケーション内で異なるキャッシュを使用することもできます。一般的なやり方として、小さくとも常に使用されるデータ (例えば、統計データ) を格納する場合はメモリベースのキャッシュストレージを使用し、大きくて使用頻度の低いデータ (例えば、ページコンテント) を格納する場合はファイルベース、またはデータベースのキャッシュストレージを使用します 。

4
docs/guide-pt-BR/caching-data.md

@ -96,10 +96,6 @@ Yii suporta uma ampla gama de sistemas de cache. A seguir um resumo:
[Redis](http://redis.io/) (requer redis versão 2.6.12 ou mais recente).
* [[yii\caching\WinCache]]: usa a extensão PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
([veja também](http://php.net/manual/en/book.wincache.php)).
* [[yii\caching\XCache]]: usa a extensão PHP [XCache](http://xcache.lighttpd.net/).
* [[yii\caching\ZendDataCache]]: usa
[Cache de Dados Zend](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm)
como o meio de cache subjacente.
> Dica: Você pode usar vários tipos de cache na mesma aplicação. Uma estratégia comum é usar caches baseados

2
docs/guide-ru/caching-data.md

@ -75,8 +75,6 @@ Yii поддерживает множество хранилищ кэша:
* [[yii\caching\MemCache]]: использует расширения PHP [memcache](http://php.net/manual/en/book.memcache.php) и [memcached](http://php.net/manual/en/book.memcached.php). Этот вариант может рассматриваться как самый быстрый при работе в распределенных приложениях (например, с несколькими серверами, балансировкой нагрузки и так далее);
* [[yii\redis\Cache]]: реализует компонент кэша на основе [Redis](http://redis.io/), хранилища ключ-значение (требуется Redis версии 2.6.12 или выше);
* [[yii\caching\WinCache]]: использует расширение PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension) ([смотрите также](http://php.net/manual/en/book.wincache.php));
* [[yii\caching\XCache]]: использует расширение PHP [XCache](http://xcache.lighttpd.net/);
* [[yii\caching\ZendDataCache]]: использует [Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm).
> Tip: Вы можете использовать разные способы хранения кэша в одном приложении. Общая стратегия заключается в использовании памяти под хранение небольших часто используемых данных (например, статистические данные). Для больших и реже используемых данных (например, содержимое страницы) лучше использовать файлы или базу данных.

3
docs/guide-zh-CN/caching-data.md

@ -74,9 +74,6 @@ Yii 支持一系列缓存存储器,概况如下:
* [[yii\caching\MemCache]]:使用 PHP [memcache](http://php.net/manual/en/book.memcache.php) 和 [memcached](http://php.net/manual/en/book.memcached.php) 扩展。这个选项被看作分布式应用环境中(例如:多台服务器,有负载均衡等)最快的缓存方案。
* [[yii\redis\Cache]]:实现了一个基于 [Redis](http://redis.io/) 键值对存储器的缓存组件(需要 redis 2.6.12 及以上版本的支持 )。
* [[yii\caching\WinCache]]:使用 PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)([另可参考](http://php.net/manual/en/book.wincache.php))扩展.
* [[yii\caching\XCache]]:使用 PHP [XCache](http://xcache.lighttpd.net/)扩展。
* [[yii\caching\ZendDataCache]]:使用 [Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm) 作为底层缓存媒介。
> Tip: 你可以在同一个应用程序中使用不同的缓存存储器。一个常见的策略是使用基于内存的缓存存储器存储小而常用的数据(例如:统计数据),使用基于文件或数据库的缓存存储器存储大而不太常用的数据(例如:网页内容)。

4
docs/guide/caching-data.md

@ -99,10 +99,6 @@ Yii supports a wide range of cache storage. The following is a summary:
(redis version 2.6.12 or higher is required).
* [[yii\caching\WinCache]]: uses PHP [WinCache](http://iis.net/downloads/microsoft/wincache-extension)
([see also](http://php.net/manual/en/book.wincache.php)) extension.
* [[yii\caching\XCache]]: uses PHP [XCache](http://xcache.lighttpd.net/) extension.
* [[yii\caching\ZendDataCache]]: uses
[Zend Data Cache](http://files.zend.com/help/Zend-Server-6/zend-server.htm#data_cache_component.htm)
as the underlying caching medium.
> Tip: You may use different cache storage in the same application. A common strategy is to use memory-based

1
framework/CHANGELOG.md

@ -9,6 +9,7 @@ Yii Framework 2 Change Log
- Chg #11397: Minimum required version of PHP is 5.5.0 now (samdark)
- Chg: Removed `yii\base\Object::className()` in favor of native PHP syntax `::class`, which does not trigger autoloading (cebe)
- Chg #12074: Updated `yii\widgets\ActiveField::hint()` method signature to match `label()` (PowerGamer1, samdark)
- Chg #11560: Removed XCache and Zend data cache support as caching backends (samdark)
2.0.10 under development
------------------------

106
framework/caching/XCache.php

@ -1,106 +0,0 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\caching;
/**
* XCache provides XCache caching in terms of an application component.
*
* To use this application component, the [XCache PHP extension](http://xcache.lighttpd.net/) must be loaded.
* Also note that the [[flush()]] functionality will work correctly only if "xcache.admin.enable_auth"
* is set to "Off" in php.ini.
*
* See [[Cache]] for common cache operations that XCache supports.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class XCache extends Cache
{
/**
* Checks whether a specified key exists in the cache.
* This can be faster than getting the value from the cache if the data is big.
* Note that this method does not check whether the dependency associated
* with the cached data, if there is any, has changed. So a call to [[get]]
* may return false while exists returns true.
* @param mixed $key a key identifying the cached value. This can be a simple string or
* a complex data structure consisting of factors representing the key.
* @return boolean true if a value exists in cache, false if the value is not in the cache or expired.
*/
public function exists($key)
{
$key = $this->buildKey($key);
return xcache_isset($key);
}
/**
* Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class.
* @param string $key a unique key identifying the cached value
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
*/
protected function getValue($key)
{
return xcache_isset($key) ? xcache_get($key) : false;
}
/**
* Stores a value identified by a key in cache.
* This is the implementation of the method declared in the parent class.
*
* @param string $key the key identifying the value to be cached
* @param string $value the value to be cached
* @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire.
* @return boolean true if the value is successfully stored into cache, false otherwise
*/
protected function setValue($key, $value, $duration)
{
return xcache_set($key, $value, $duration);
}
/**
* Stores a value identified by a key into cache if the cache does not contain this key.
* This is the implementation of the method declared in the parent class.
*
* @param string $key the key identifying the value to be cached
* @param string $value the value to be cached
* @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire.
* @return boolean true if the value is successfully stored into cache, false otherwise
*/
protected function addValue($key, $value, $duration)
{
return !xcache_isset($key) ? $this->setValue($key, $value, $duration) : false;
}
/**
* Deletes a value with the specified key from cache
* This is the implementation of the method declared in the parent class.
* @param string $key the key of the value to be deleted
* @return boolean if no error happens during deletion
*/
protected function deleteValue($key)
{
return xcache_unset($key);
}
/**
* Deletes all values from cache.
* This is the implementation of the method declared in the parent class.
* @return boolean whether the flush operation was successful.
*/
protected function flushValues()
{
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
return false;
}
}
return true;
}
}

2
framework/classes.php

@ -72,8 +72,6 @@ return [
'yii\caching\MemCacheServer' => YII2_PATH . '/caching/MemCacheServer.php',
'yii\caching\TagDependency' => YII2_PATH . '/caching/TagDependency.php',
'yii\caching\WinCache' => YII2_PATH . '/caching/WinCache.php',
'yii\caching\XCache' => YII2_PATH . '/caching/XCache.php',
'yii\caching\ZendDataCache' => YII2_PATH . '/caching/ZendDataCache.php',
'yii\captcha\Captcha' => YII2_PATH . '/captcha/Captcha.php',
'yii\captcha\CaptchaAction' => YII2_PATH . '/captcha/CaptchaAction.php',
'yii\captcha\CaptchaAsset' => YII2_PATH . '/captcha/CaptchaAsset.php',

30
tests/framework/caching/XCacheTest.php

@ -1,30 +0,0 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\XCache;
/**
* Class for testing xcache backend
* @group xcache
* @group caching
*/
class XCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
/**
* @return XCache
*/
protected function getCacheInstance()
{
if (!function_exists("xcache_isset")) {
$this->markTestSkipped("XCache not installed. Skipping.");
}
if ($this->_cacheInstance === null) {
$this->_cacheInstance = new XCache();
}
return $this->_cacheInstance;
}
}

30
tests/framework/caching/ZendDataCacheTest.php

@ -1,30 +0,0 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\ZendDataCache;
/**
* Class for testing Zend cache backend
* @group zenddata
* @group caching
*/
class ZendDataCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
/**
* @return ZendDataCache
*/
protected function getCacheInstance()
{
if (!function_exists("zend_shm_cache_store")) {
$this->markTestSkipped("Zend Data cache not installed. Skipping.");
}
if ($this->_cacheInstance === null) {
$this->_cacheInstance = new ZendDataCache();
}
return $this->_cacheInstance;
}
}
Loading…
Cancel
Save