Plugin Directory

Changeset 1394450


Ignore:
Timestamp:
04/13/2016 05:08:46 PM (9 years ago)
Author:
andy
Message:

memcached: insert delimiter after key salt and make the salt mutable

File:
1 edited

Legend:

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

    r1393336 r1394450  
    272272            $group = 'default';
    273273
     274        $prefix = $this->key_salt;
     275
    274276        if ( false !== array_search($group, $this->global_groups) )
    275             $prefix = $this->global_prefix;
     277            $prefix .= $this->global_prefix;
    276278        else
    277             $prefix = $this->blog_prefix;
    278 
    279         return preg_replace('/\s+/', '', WP_CACHE_KEY_SALT . "$prefix$group:$key");
     279            $prefix .= $this->blog_prefix;
     280
     281        return preg_replace('/\s+/', '', "$prefix$group:$key");
    280282    }
    281283
     
    366368    function failure_callback($host, $port) {
    367369        //error_log("Connection failure for $host:$port\n", 3, '/tmp/memcached.txt');
     370    }
     371
     372    function salt_keys( $key_salt ) {
     373        if ( strlen( $key_salt ) )
     374            $this->key_salt = $key_salt . ':';
     375        else
     376            $this->key_salt = '';
    368377    }
    369378
     
    407416        }
    408417
     418        $this->salt_keys( WP_CACHE_KEY_SALT );
     419
    409420        $this->cache_hits =& $this->stats['get'];
    410421        $this->cache_misses =& $this->stats['add'];
Note: See TracChangeset for help on using the changeset viewer.