mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
documentation and code style fixes
This commit is contained in:
@ -24,7 +24,7 @@ class ApcCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -247,7 +247,7 @@ abstract class Cache extends Component implements \ArrayAccess
|
||||
* This method should be implemented by child classes to retrieve the data
|
||||
* from specific cache storage.
|
||||
* @param string $key a unique key identifying the cached value
|
||||
* @return string the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
abstract protected function getValue($key);
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class DbCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ class DummyCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -61,7 +61,7 @@ class FileCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -145,7 +145,7 @@ class MemCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -49,11 +49,11 @@ class RedisCache extends Cache
|
||||
*/
|
||||
public $hostname = 'localhost';
|
||||
/**
|
||||
* @var int the to use for connecting to the redis server. Default port is 6379.
|
||||
* @var int the port to use for connecting to the redis server. Default port is 6379.
|
||||
*/
|
||||
public $port = 6379;
|
||||
/**
|
||||
* @var string the password to use to identify with the redis server. If not set, no AUTH command will be sent.
|
||||
* @var string the password to use to authenticate with the redis server. If not set, no AUTH command will be sent.
|
||||
*/
|
||||
public $password;
|
||||
/**
|
||||
@ -102,7 +102,7 @@ class RedisCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ class WinCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -25,7 +25,7 @@ class XCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ class ZendDataCache extends Cache
|
||||
* 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 the value stored in cache, false if the value is not in the cache or expired.
|
||||
* @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
|
||||
*/
|
||||
protected function getValue($key)
|
||||
{
|
||||
|
||||
@ -379,14 +379,13 @@ class Connection extends Component
|
||||
case '-': // Error reply
|
||||
throw new Exception("Redis error: " . $line . "\nRedis command was: " . $command);
|
||||
case ':': // Integer reply
|
||||
// no cast to integer as it is in the range of a signed 64 bit integer
|
||||
// no cast to int as it is in the range of a signed 64 bit integer
|
||||
return $line;
|
||||
case '$': // Bulk replies
|
||||
if ($line == '-1') {
|
||||
return null;
|
||||
}
|
||||
$data = fread($this->_socket, $line + 2);
|
||||
if($data===false) {
|
||||
if(($data = fread($this->_socket, $line + 2))===false) {
|
||||
throw new Exception("Failed to read from socket.\nRedis command was: " . $command);
|
||||
}
|
||||
return substr($data, 0, -2);
|
||||
|
||||
@ -117,6 +117,7 @@ abstract class CacheTest extends TestCase
|
||||
$this->assertEquals(42, $cache->get('number_test'));
|
||||
|
||||
// should store data if it's not there yet
|
||||
$this->assertFalse($cache->get('add_test'));
|
||||
$this->assertTrue($cache->add('add_test', 13));
|
||||
$this->assertEquals(13, $cache->get('add_test'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user