Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
R
Redis Page Cache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WP Plugins
Redis Page Cache
Commits
20469b96
Commit
20469b96
authored
Feb 27, 2014
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Output content encoding headers for happy receipients
parent
1ca474a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
index-redis-page-cache.php
index-redis-page-cache.php
+11
-6
No files found.
index-redis-page-cache.php
View file @
20469b96
...
...
@@ -315,6 +315,9 @@ try {
// Retrieve cached page, which is an array that includes meta data along with the page output
$cache
=
unserialize
(
$redis
->
get
(
$redis_page_cache_config
[
'redis_key'
]
)
);
// Set headers related to content type
header
(
'Content-Type: '
.
$cache
[
'content_type'
]
.
'; charset='
.
$cache
[
'content_encoding'
],
true
);
// Output cached headers from original page
if
(
!
empty
(
$cache
[
'headers'
]
)
)
{
foreach
(
$cache
[
'headers'
]
as
$key
=>
$value
)
{
...
...
@@ -332,7 +335,7 @@ try {
echo
trim
(
$cache
[
'output'
]
);
// Display generation stats if requested
if
(
$redis_page_cache_config
[
'stats'
]
)
{
if
(
'application/xml'
!==
$cache
[
'content_type'
]
&&
$redis_page_cache_config
[
'stats'
]
)
{
echo
"
\n
<!-- Page cached via Redis using the Redis Page Cache plugin (http://eth.pw/rpc). -->"
;
echo
"
\n
<!-- Retrieved from cache in "
.
redis_page_cache_time_elapsed
(
$start
,
microtime
()
)
.
" seconds. -->"
;
}
...
...
@@ -364,7 +367,7 @@ try {
echo
$output
;
// Display generation stats if requested
if
(
$redis_page_cache_config
[
'stats'
]
)
{
if
(
!
is_feed
()
&&
$redis_page_cache_config
[
'stats'
]
)
{
echo
"
\n
<!-- Page NOT cached via Redis using the Redis Page Cache plugin (http://eth.pw/rpc). -->"
;
echo
"
\n
<!-- Generated and cached in "
.
redis_page_cache_time_elapsed
(
$start
,
microtime
()
)
.
" seconds. -->"
;
}
...
...
@@ -376,6 +379,8 @@ try {
'output'
=>
$output
,
'time'
=>
time
(),
'age'
=>
31536000
,
// one year in seconds
'content_type'
=>
is_feed
()
?
'application/xml'
:
'text/html'
,
'content_encoding'
=>
get_option
(
'blog_charset'
,
'UTF-8'
),
'headers'
=>
array
(),
);
...
...
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