Plugin Directory

Changeset 539529


Ignore:
Timestamp:
05/03/2012 05:27:45 PM (14 years ago)
Author:
sivel
Message:

Add WP_CACHE_KEY_SALT that can be configured for wp-config.php to ensure the uniqueness of keys generated by this object cache when sharing a wp-config.php or for multiple databases that use the same .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • memcached/trunk/object-cache.php

    r435898 r539529  
    1010Install this file to wp-content/object-cache.php
    1111*/
     12
     13// Users with setups where multiple installs share a common wp-config.php or $table_prefix
     14// can use this to guarantee uniqueness for the keys generated by this object cache
     15if ( !defined( 'WP_CACHE_KEY_SALT' ) )
     16    define( 'WP_CACHE_KEY_SALT', '' );
    1217
    1318function wp_cache_add($key, $data, $group = '', $expire = 0) {
     
    264269            $prefix = $this->blog_prefix;
    265270
    266         return preg_replace('/\s+/', '', "$prefix$group:$key");
     271        return preg_replace('/\s+/', '', WP_CACHE_KEY_SALT . "$prefix$group:$key");
    267272    }
    268273
Note: See TracChangeset for help on using the changeset viewer.