Platinum Partner

Php-memcache Wrapper


addServer($server, $port))) {
      throw new Exception(sprintf('Could not connect to Memcache server: %s:%s', $server, $port));
    }
  }

  public static function exists($key) {
    return ((self::$_memcache->get($key)) && (self::$_memcache->getResultCode() == Memcache::RES_SUCCESS));
  }

  public static function get($key) {
    return self::$_memcache->get($key);
  }

  public static function set($key, $value, $expiration=0) {
    if (!(self::$_memcache->set($key, $value, 0, $expiration))) {
      throw new Exception(
        sprintf('ERROR: Failed to store key pair \'%s\' = \'%s\' in cache.',
          $key,
          $value
        )
      );
    }
  }

  public static function delete($key) {
    self::$_memcache->delete($key);
  }

  public static function flush() { self::$_memcache->flush(); }
  public static function print_status(){
    $status = self::$_memcache->getStats();
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    echo "";
    $percCacheHit=((real)$status ["get_hits"]/ (real)$status ["cmd_get"] *100);
    $percCacheHit=round($percCacheHit,3);
    $percCacheMiss=100-$percCacheHit;
    echo "";
    echo "";
    $MBRead= (real)$status["bytes_read"]/(1024*1024);
    echo "";
    $MBWrite=(real) $status["bytes_written"]/(1024*1024) ;
    echo "";
    $MBSize=(real) $status["limit_maxbytes"]/(1024*1024) ;
    echo "";
    echo "";
    echo "
Memcache Server version: ".$status ["version"]."
Process id of this server process ".$status ["pid"]."
Number of seconds this server has been running ".$status ["uptime"]."
Accumulated user time for this process ".$status ["rusage_user"]." seconds
Accumulated system time for this process ".$status ["rusage_system"]." seconds
Total number of items stored by this server ever since it started ".$status ["total_items"]."
Number of open connections ".$status ["curr_connections"]."
Total number of connections opened since the server started running ".$status ["total_connections"]."
Number of connection structures allocated by the server ".$status ["connection_structures"]."
Cumulative number of retrieval requests ".$status ["cmd_get"]."
Cumulative number of storage requests ".$status ["cmd_set"]."
Number of keys that have been requested and found present ".$status ["get_hits"]." ($percCacheHit%)
Number of items that have been requested and not found ".$status ["get_misses"]."($percCacheMiss%)
Total number of bytes read by this server from network ".$MBRead." Mega Bytes
Total number of bytes sent by this server to network ".$MBWrite." Mega Bytes
Number of bytes this server is allowed to use for storage.".$MBSize." Mega Bytes
Number of valid items removed from cache to free memory for new items.".$status ["evictions"]."
"; } } ?>
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}