diff --git a/README.md b/README.md index 02bc3a6..8237bc5 100644 --- a/README.md +++ b/README.md @@ -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! @@ -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 ## @@ -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 \ No newline at end of file +[10]: https://github.com/l3rady/WordPress-APC-Object-Cache/pull/10 +[11]: https://pecl.php.net/package/apcu_bc diff --git a/object-cache.php b/object-cache.php index 8707f22..9846038 100644 --- a/object-cache.php +++ b/object-cache.php @@ -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 ); @@ -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; } @@ -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; } @@ -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; }