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
80bc6811
Commit
80bc6811
authored
Jul 04, 2013
by
resurtm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs on caching:
1. Remove unnecessary samples. 2. Add configuration file location note for basic application. 3. Fix a couple of typos.
parent
33c36f2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
caching.md
docs/guide/caching.md
+5
-10
No files found.
docs/guide/caching.md
View file @
80bc6811
...
@@ -9,7 +9,8 @@ static data in cache and serving it from cache when requested, we save the time
...
@@ -9,7 +9,8 @@ static data in cache and serving it from cache when requested, we save the time
Using cache in Yii mainly involves configuring and accessing a cache application component. The following
Using cache in Yii mainly involves configuring and accessing a cache application component. The following
application configuration specifies a cache component that uses
[
memcached
](
http://memcached.org/
)
with
application configuration specifies a cache component that uses
[
memcached
](
http://memcached.org/
)
with
two cache servers.
two cache servers. Note, this configuration should be done in file located at
`@app/config/web.php`
alias
in case you're using basic sample application.
```
php
```
php
'components'
=>
array
(
'components'
=>
array
(
...
@@ -33,14 +34,8 @@ two cache servers.
...
@@ -33,14 +34,8 @@ two cache servers.
When the application is running, the cache component can be accessed through
`Yii::$app->cache`
call.
When the application is running, the cache component can be accessed through
`Yii::$app->cache`
call.
Yii provides various cache components that can store cached data in different media. For example,
Yii provides various cache components that can store cached data in different media. The following
the
[
[\yii\caching\MemCache
]
] component encapsulates the PHP
[
memcache
](
http://php.net/manual/en/book.memcache.php
)
is a summary of the available cache components:
and
[
memcached
](
http://php.net/manual/en/book.memcached.php
)
extensions and uses memory as the medium
of cache storage; the
[
[\yii\caching\ApcCache
]
] component encapsulates the PHP
[
APC
](
http://php.net/manual/en/book.apc.php
)
extension; and the
[
[\yii\caching\DbCache
]
] component stores
cached data in database table.
The following is a summary of the available cache components:
*
[
[\yii\caching\ApcCache
]
]: uses PHP
[
APC
](
http://php.net/manual/en/book.apc.php
)
extension. This option can be
*
[
[\yii\caching\ApcCache
]
]: uses PHP
[
APC
](
http://php.net/manual/en/book.apc.php
)
extension. This option can be
considered as the fastest one when dealing with cache for a centralized thick application (e.g. one
considered as the fastest one when dealing with cache for a centralized thick application (e.g. one
...
@@ -144,7 +139,7 @@ to exploit this feature. In case the underlying cache storage does not support t
...
@@ -144,7 +139,7 @@ to exploit this feature. In case the underlying cache storage does not support t
To remove a cached value from cache, call
[
[delete()
]
]; and to remove everything from cache, call
[
[flush()
]
].
To remove a cached value from cache, call
[
[delete()
]
]; and to remove everything from cache, call
[
[flush()
]
].
Be very careful when calling
[
[flush()
]
] because it also removes cached data that are from other applications.
Be very careful when calling
[
[flush()
]
] because it also removes cached data that are from other applications.
Note, because
CCache implements ArrayAccess
, a cache component can be used liked an array. The followings
Note, because
[
[Cache
]
] implements
`ArrayAccess`
, a cache component can be used liked an array. The followings
are some examples:
are some examples:
```
php
```
php
...
...
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