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
63b01d13
Commit
63b01d13
authored
Feb 27, 2014
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better code organization and some inline comments for the changes from 19d6f1.
See
#3
.
parent
19d6f15a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
index-redis-page-cache.php
index-redis-page-cache.php
+8
-5
No files found.
index-redis-page-cache.php
View file @
63b01d13
...
...
@@ -308,25 +308,28 @@ try {
$load_wp
=
false
;
$redis_page_cache_config
[
'cached'
]
=
true
;
// 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'
]
)
);
// Output cache headers if desired
if
(
$redis_page_cache_config
[
'cache_headers'
]
)
{
header
(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
,
$cache
[
'time'
]
)
.
' GMT'
,
true
);
header
(
'Cache-Control: max-age='
.
$cache
[
'age'
]
.
', must-revalidate'
,
false
);
}
// Output page content
echo
trim
(
$cache
[
'output'
]
);
if
(
$redis_page_cache_config
[
'debug'
]
)
{
$redis_page_cache_config
[
'debug_messages'
]
.
=
"<!-- Last Modified: "
.
gmdate
(
'D, d M Y H:i:s'
,
$cache
[
'time'
]
)
.
" GMT . -->
\n
"
;
$redis_page_cache_config
[
'debug_messages'
]
.
=
"<!-- Max Age: "
.
$cache
[
'age'
]
.
" -->
\n
"
;
}
// Display generation stats if requested
if
(
$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. -->"
;
}
if
(
$redis_page_cache_config
[
'debug'
]
)
{
$redis_page_cache_config
[
'debug_messages'
]
.
=
"<!-- Last Modified: "
.
gmdate
(
'D, d M Y H:i:s'
,
$cache
[
'time'
]
)
.
" GMT . -->
\n
"
;
$redis_page_cache_config
[
'debug_messages'
]
.
=
"<!-- Max Age: "
.
$cache
[
'age'
]
.
" -->
\n
"
;
}
// If the cache does not exist lets display the user the normal page without cache, and then fetch a new cache page
}
elseif
(
$_SERVER
[
'REMOTE_ADDR'
]
!=
$redis_page_cache_config
[
'server_ip'
]
)
{
if
(
false
===
strstr
(
$redis_page_cache_config
[
'current_url'
],
'preview=true'
)
)
{
...
...
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