Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
Redis Page Cache
Commits
31efdc47
Commit
31efdc47
authored
Feb 17, 2014
by
Rueben Ramirez
Browse files
providing funciton params
parent
748d1f5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
index-wp-redis.php
View file @
31efdc47
...
...
@@ -17,7 +17,8 @@ function requestHasSecret($secret) {
}
function
isRemotePageLoad
(
$currentUrl
,
$websiteIp
)
{
return
(
$_SERVER
[
'HTTP_REFERER'
]
==
$currentUrl
return
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
&&
$_SERVER
[
'HTTP_REFERER'
]
==
$currentUrl
&&
$_SERVER
[
'REQUEST_URI'
]
!=
'/'
&&
$_SERVER
[
'REMOTE_ADDR'
]
!=
$websiteIp
);
}
...
...
@@ -39,11 +40,10 @@ function getCleanUrl($secret) {
$debug
=
true
;
$cache
=
false
;
$
ip_of_your_website
=
'127.0.0.1'
;
$
websiteIp
=
'127.0.0.1'
;
$reddis_server
=
'127.0.0.1'
;
$secret_string
=
'changeme'
;
$unlimited
=
get_option
(
'wp-redis-cache-debug'
,
false
);
$seconds_cache_redis
=
get_option
(
'wp-redis-cache-seconds'
,
43200
);
handleCDNRemoteAddressing
();
...
...
@@ -68,10 +68,12 @@ try {
}
//Either manual refresh cache by adding ?refresh=secret_string after the URL or somebody posting a comment
if
(
refreshHasSecret
()
||
requestHasSecret
()
||
isRemotePageLoad
())
{
if
(
refreshHasSecret
(
$secret_string
)
||
requestHasSecret
(
$secret_string
)
||
isRemotePageLoad
(
$current_url
,
$websiteIp
))
{
$redis
->
del
(
$redis_key
);
require
(
'./wp-blog-header.php'
);
$unlimited
=
get_option
(
'wp-redis-cache-debug'
,
false
);
$seconds_cache_redis
=
get_option
(
'wp-redis-cache-seconds'
,
43200
);
// This page is cached, lets display it
}
else
if
(
$redis
->
exists
(
$redis_key
))
{
$cache
=
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