Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3eae6942
Commit
3eae6942
authored
Jun 10, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve cache phpdoc
parent
75b1f481
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
Cache.php
framework/caching/Cache.php
+7
-7
DbCache.php
framework/caching/DbCache.php
+2
-2
No files found.
framework/caching/Cache.php
View file @
3eae6942
...
@@ -11,9 +11,9 @@ use yii\base\Component;
...
@@ -11,9 +11,9 @@ use yii\base\Component;
use
yii\helpers\StringHelper
;
use
yii\helpers\StringHelper
;
/**
/**
* Cache is the base class for cache classes supporting different cache storage implementation.
* Cache is the base class for cache classes supporting different cache storage implementation
s
.
*
*
* A data item can be stored in cache by calling [[set()]] and be retrieved back
* A data item can be stored in
the
cache by calling [[set()]] and be retrieved back
* later (in the same or different request) by [[get()]]. In both operations,
* later (in the same or different request) by [[get()]]. In both operations,
* a key identifying the data item is required. An expiration time and/or a [[Dependency|dependency]]
* a key identifying the data item is required. An expiration time and/or a [[Dependency|dependency]]
* can also be specified when calling [[set()]]. If the data item expires or the dependency
* can also be specified when calling [[set()]]. If the data item expires or the dependency
...
@@ -21,23 +21,23 @@ use yii\helpers\StringHelper;
...
@@ -21,23 +21,23 @@ use yii\helpers\StringHelper;
*
*
* A typical usage pattern of cache is like the following:
* A typical usage pattern of cache is like the following:
*
*
*
~~~
*
```php
* $key = 'demo';
* $key = 'demo';
* $data = $cache->get($key);
* $data = $cache->get($key);
* if ($data === false) {
* if ($data === false) {
* // ...generate $data here...
* // ...generate $data here...
* $cache->set($key, $data, $duration, $dependency);
* $cache->set($key, $data, $duration, $dependency);
* }
* }
*
~~~
*
```
*
*
* Because Cache implements the ArrayAccess interface, it can be used like an array. For example,
* Because Cache implements the ArrayAccess interface, it can be used like an array. For example,
*
*
*
~~~
*
```php
* $cache['foo'] = 'some data';
* $cache['foo'] = 'some data';
* echo $cache['foo'];
* echo $cache['foo'];
*
~~~
*
```
*
*
* Derived classes should implement the following methods:
* Derived classes should implement the following methods
which do the actual cache storage operations
:
*
*
* - [[getValue()]]: retrieve the value with a key (if any) from cache
* - [[getValue()]]: retrieve the value with a key (if any) from cache
* - [[setValue()]]: store the value with a key into cache
* - [[setValue()]]: store the value with a key into cache
...
...
framework/caching/DbCache.php
View file @
3eae6942
...
@@ -23,13 +23,13 @@ use yii\di\Instance;
...
@@ -23,13 +23,13 @@ use yii\di\Instance;
*
*
* The following example shows how you can configure the application to use DbCache:
* The following example shows how you can configure the application to use DbCache:
*
*
*
~~~
*
```php
* 'cache' => [
* 'cache' => [
* 'class' => 'yii\caching\DbCache',
* 'class' => 'yii\caching\DbCache',
* // 'db' => 'mydb',
* // 'db' => 'mydb',
* // 'cacheTable' => 'my_cache',
* // 'cacheTable' => 'my_cache',
* ]
* ]
*
~~~
*
```
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment