Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ version has been cherry picked over to this version.

## Installation ##

1. Verify that you have PHP 5.2.4+ and a compatible APC version installed.
1. Verify that you have PHP 5.2.4+ and a compatible APC version installed. PHP7 users will need to install the [APCu_bc][11] extension
2. Copy `object-cache.php` to your WordPress content directory (`wp-content/` by default).
3. Done!

Expand All @@ -36,7 +36,7 @@ Maybe, but I'm not going to support them, and you shouldn't still be running the

### I share `wp-config.php` among multiple WordPress installs. How can I guarantee key uniqueness? ###

Define `WP_APC_KEY_SALT` to something that is unique for each install (like an md5 of the MySQL host, database, and table prefix).
Define `WP_CACHE_KEY_SALT` to something that is unique for each install (like an md5 of the MySQL host, database, and table prefix).

## Changelog ##

Expand Down Expand Up @@ -72,4 +72,5 @@ Define `WP_APC_KEY_SALT` to something that is unique for each install (like an m
[7]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/1
[8]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/7
[9]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/9
[10]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/10
[10]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/10
[11]: https://pecl.php.net/package/apcu_bc
10 changes: 5 additions & 5 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ private function __clone() {
private function __construct() {
global $blog_id;

if ( !defined( 'WP_APC_KEY_SALT' ) ) {
if ( !defined( 'WP_CACHE_KEY_SALT' ) ) {
/**
* Set in config if you are using some sort of shared
* config where ABSPATH is the same on all sites
*/
define( 'WP_APC_KEY_SALT', 'wp' );
define( 'WP_CACHE_KEY_SALT', 'wp' );
}

$this->abspath = md5( ABSPATH );
Expand All @@ -385,7 +385,7 @@ private function __construct() {
* @return bool False if cache key and group already exist, true on success
*/
public function add( $key, $var, $group = 'default', $ttl = 0 ) {
if ( wp_suspend_cache_addition() ) {
if ( function_exists('wp_suspend_cache_addition') && wp_suspend_cache_addition() ) {
return false;
}

Expand Down Expand Up @@ -791,7 +791,7 @@ private function _get_cache_version( $key ) {
* @return string The key
*/
private function _get_cache_version_key( $type, $value ) {
return WP_APC_KEY_SALT . ':' . $this->abspath . ':' . $type . ':' . $value;
return WP_CACHE_KEY_SALT . ':' . $this->abspath . ':' . $type . ':' . $value;
}


Expand Down Expand Up @@ -969,7 +969,7 @@ private function _key( $key, $group ) {
$group_version = $this->_get_group_cache_version( $group );
$site_version = $this->_get_site_cache_version( $prefix );

return WP_APC_KEY_SALT . ':' . $this->abspath . ':' . $prefix . ':' . $group . ':' . $key . ':v' . $site_version . '.' . $group_version;
return WP_CACHE_KEY_SALT . ':' . $this->abspath . ':' . $prefix . ':' . $group . ':' . $key . ':v' . $site_version . '.' . $group_version;
}


Expand Down