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
5c933fae
Commit
5c933fae
authored
Jan 11, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added docs about query caching. fixes #1917
parent
2c86d7a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
caching.md
docs/guide/caching.md
+10
-2
performance.md
docs/guide/performance.md
+2
-1
No files found.
docs/guide/caching.md
View file @
5c933fae
...
@@ -6,7 +6,7 @@ static data in cache and serving it from cache when requested, the application s
...
@@ -6,7 +6,7 @@ static data in cache and serving it from cache when requested, the application s
Base Concepts
Base Concepts
-------------
-------------
-------------
Using cache in Yii involves configuring and accessing a cache application component. The following
Using cache in Yii 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
...
@@ -182,7 +182,15 @@ Below is a summary of the available cache dependencies:
...
@@ -182,7 +182,15 @@ Below is a summary of the available cache dependencies:
### Query Caching
### Query Caching
TBD: http://www.yiiframework.com/doc/guide/1.1/en/caching.data#query-caching
For caching the result of database queries you can wrap them in calls to
[
[yii\db\Connection::beginCache()
]
]
and
[
[yii\db\Connection::endCache()
]
]:
```
php
$connection
->
beginCache
(
60
);
// cache all query results for 60 seconds.
// your db query code here...
$connection
->
endCache
();
```
Fragment Caching
Fragment Caching
----------------
----------------
...
...
docs/guide/performance.md
View file @
5c933fae
...
@@ -158,7 +158,8 @@ used to generate `ETag` header value.
...
@@ -158,7 +158,8 @@ used to generate `ETag` header value.
### Database Optimization
### Database Optimization
Fetching data from database is often the main performance bottleneck in
Fetching data from database is often the main performance bottleneck in
a Web application. Although using caching may alleviate the performance hit,
a Web application.
Although using
[
caching
](
caching.md#Query-Caching
)
may alleviate the performance hit,
it does not fully solve the problem. When the database contains enormous data
it does not fully solve the problem. When the database contains enormous data
and the cached data is invalid, fetching the latest data could be prohibitively
and the cached data is invalid, fetching the latest data could be prohibitively
expensive without proper database and query design.
expensive without proper database and query design.
...
...
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