Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
WP Plugins
Redis Page Cache
Commits
8daf8dc4
Commit
8daf8dc4
authored
Feb 26, 2014
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Redis connection to its own function, for clarity.
parent
0ca5e34c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
index-wp-redis.php
index-wp-redis.php
+25
-11
No files found.
index-wp-redis.php
View file @
8daf8dc4
...
...
@@ -107,18 +107,13 @@ function wp_redis_cache_get_clean_url( $secret ) {
}
/**
* BEGIN CACHING LOGIC
* Establish a connection to the Redis server
*
* Will try the PECL module first, then fall back to PRedis
*
* @return object
*/
// Set proper IP for proxied requests
wp_redis_cache_handle_cdn_remote_addressing
();
// Ensure WP uses a theme (this is normally set in index.php)
if
(
!
defined
(
'WP_USE_THEMES'
)
)
{
define
(
'WP_USE_THEMES'
,
true
);
}
try
{
function
wp_redis_cache_connect_redis
()
{
// check if PECL Extension is available
if
(
class_exists
(
'Redis'
)
)
{
if
(
$GLOBALS
[
'wp_redis_cache_config'
][
'debug'
]
)
{
...
...
@@ -143,6 +138,25 @@ try {
)
);
}
return
$redis
;
}
/**
* BEGIN CACHING LOGIC
*/
// Set proper IP for proxied requests
wp_redis_cache_handle_cdn_remote_addressing
();
// Ensure WP uses a theme (this is normally set in index.php)
if
(
!
defined
(
'WP_USE_THEMES'
)
)
{
define
(
'WP_USE_THEMES'
,
true
);
}
try
{
// Establish connection with Redis server
$redis
=
wp_redis_cache_connect_redis
();
//Either manual refresh cache by adding ?refresh=secret_string after the URL or somebody posting a comment
if
(
wp_redis_cache_refresh_has_secret
(
$GLOBALS
[
'wp_redis_cache_config'
][
'secret_string'
]
)
||
wp_redis_cache_request_has_secret
(
$GLOBALS
[
'wp_redis_cache_config'
][
'secret_string'
]
)
||
wp_redis_cache_is_remote_page_load
(
$GLOBALS
[
'wp_redis_cache_config'
][
'current_url'
],
$GLOBALS
[
'wp_redis_cache_config'
][
'server_ip'
]
)
)
{
if
(
$GLOBALS
[
'wp_redis_cache_config'
][
'debug'
]
)
{
...
...
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