Plugin Directory

Changeset 1435867


Ignore:
Timestamp:
06/13/2016 02:09:16 PM (10 years ago)
Author:
prettyboymp
Message:

adding $force and &$found support

Location:
memcached-redux/trunk
Files:
2 edited

Legend:

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

    r874836 r1435867  
    33Plugin Name: Memcached Redux
    44Description: The real Memcached (not Memcache) backend for the WP Object Cache.
    5 Version: 0.1.3
     5Version: 0.1.4
    66Plugin URI: http://wordpress.org/extend/plugins/memcached/
    77Author: Scott Taylor - uses code from Ryan Boren, Denis de Bernardy, Matt Martz, Mike Schroder
     
    5252}
    5353
    54 function wp_cache_get( $key, $group = '' ) {
    55     global $wp_object_cache;
    56 
    57     return $wp_object_cache->get( $key, $group );
     54function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
     55    global $wp_object_cache;
     56
     57    return $wp_object_cache->get( $key, $group, $force, $found );
    5858}
    5959
     
    224224    }
    225225
    226     function get( $id, $group = 'default' ) {
    227         $key = $this->key( $id, $group );
    228         $mc =& $this->get_mc( $group );
    229 
    230         if ( isset( $this->cache[$key] ) ) {
     226    function get( $id, $group = 'default', $force = false, &$found = null ) {
     227        $key = $this->key( $id, $group );
     228        $mc =& $this->get_mc( $group );
     229        $found = false;
     230
     231        if ( isset( $this->cache[$key] ) && ( !$force || in_array( $group, $this->no_mc_groups ) ) ) {
     232            $found = true;
    231233            if ( is_object( $this->cache[$key] ) )
    232234                $value = clone $this->cache[$key];
     
    237239        } else {
    238240            $value = $mc->get( $key );
    239             if ( empty( $value ) || ( is_integer( $value ) && -1 == $value ) )
     241            if ( empty( $value ) || ( is_integer( $value ) && -1 == $value ) ){
    240242                $value = false;
     243                $found = $mc->getResultCode() !== Memcached::RES_NOTFOUND;
     244            } else {
     245                $found = true;
     246            }
    241247            $this->cache[$key] = $value;
    242248        }
  • memcached-redux/trunk/readme.txt

    r874836 r1435867  
    33Tags: cache, Memcached, admin, manage cache, object cache, WP Object Cache
    44Requires at least: 3.0
    5 Tested up to: 3.8.1
    6 Stable Tag: 0.1.3
     5Tested up to: 4.1
     6Stable Tag: 0.1.4
    77
    88Uses the Memcached class (not the Memcache class) to implement WP Object Cache
     
    3636
    3737== Changelog ==
     38= 0.1.4 =
     39* Implementing $force and &$found parameters to wp_cache_get.
    3840
    3941= 0.1.3 =
Note: See TracChangeset for help on using the changeset viewer.