Class memcached

(line 96)

Description


Located in File: /memcached-client.php

memcached client class implemented using (p)fsockopen()


Class Variables

Summary:
array $stats

$stats (line 107)

Data type : array

Command statistics
  • access: - public

Method Detail

Summary:
mixed memcached (array $args)
boolean add (string $key, mixed $val, interger $exp)
mixed decr (string $key, [interger $amt = 1])
boolean delete (string $key, interger $time)
void disconnect_all ()
void enable_compress (boolean $enable)
mixed get (string $key)
array get_multi (array $keys)
interger incr (string $key, [interger $amt = 1])
boolean replace (string $key, mixed $value, interger $exp)
array run_command (resource $sock, string $cmd)
boolean set (string $key, mixed $value, interger $exp)
void set_compress_threshold (interger $thresh)
void set_debug (boolean $dbg)
void set_servers (array $list)

Constructor memcached (line 222)

mixed memcached( array $args)

Memcache initializer

Parameters

  • array $args: Associative array of settings

Info

  • access - public

Method add (line 250)

boolean add( string $key, mixed $val, [interger $exp = 0])

Adds a key/value to the memcache server if one isn't already set with that key

Parameters

  • string $key: Key to set with data
  • mixed $val: Value to store
  • interger $exp: (optional) Time to expire data at

Info

  • access - public

Method decr (line 267)

mixed decr( string $key, [interger $amt = 1])

Decriment a value stored on the memcache server

Parameters

  • string $key: Key to decriment
  • interger $amt: (optional) Amount to decriment

Info

  • return - FALSE on failure, value on success
  • access - public

Method delete (line 284)

boolean delete( string $key, [interger $time = 0])

Deletes a key from the server, optionally after $time

Parameters

  • string $key: Key to delete
  • interger $time: (optional) How long to wait before deleting

Info

  • return - TRUE on success, FALSE on failure
  • access - public

Method disconnect_all (line 320)

void disconnect_all( )

Disconnects all connected sockets

Info

  • access - public

Method enable_compress (line 338)

void enable_compress( boolean $enable)

Enable / Disable compression

Parameters

  • boolean $enable: TRUE to enable, FALSE to disable

Info

  • access - public

Method forget_dead_hosts (line 351)

void forget_dead_hosts( )

Forget about all of the dead hosts

Info

  • access - public

Method get (line 367)

mixed get( string $key)

Retrieves the value associated with the key from the memcache server

Parameters

  • string $key: Key to retrieve

Info

  • access - public

Method get_multi (line 407)

array get_multi( array $keys)

Get multiple keys from the server(s)

Parameters

  • array $keys: Keys to retrieve

Info

  • access - public

Method incr (line 471)

interger incr( string $key, [interger $amt = 1])

Increments $key (optionally) by $amt

Parameters

  • string $key: Key to increment
  • interger $amt: (optional) amount to increment

Info

  • return - New key value?
  • access - public

Method replace (line 489)

boolean replace( string $key, mixed $value, [interger $exp = 0])

Overwrites an existing value for key; only works if key is already set

Parameters

  • string $key: Key to set value as
  • mixed $value: Value to store
  • interger $exp: (optional) Experiation time

Info

  • access - public

Method run_command (line 513)

array run_command( resource $sock, string $cmd)

Passes through $cmd to the memcache server connected by $sock; returns output as an array (null array if no output)

NOTE: due to a possible bug in how PHP reads while using fgets(), each line may not be terminated by a \r\n. More specifically, my testing has shown that, on FreeBSD at least, each line is terminated only with a \n. This is with the PHP flag auto_detect_line_endings set to falase (the default).

Parameters

  • resource $sock: Socket to send command on
  • string $cmd: Command to run

Info

  • return - Output array
  • access - public

Method set (line 547)

boolean set( string $key, mixed $value, [interger $exp = 0])

Unconditionally sets a key to a given value in the memcache. Returns true if set successfully.

Parameters

  • string $key: Key to set value as
  • mixed $value: Value to set
  • interger $exp: (optional) Experiation time

Info

  • return - TRUE on success
  • access - public

Method set_compress_threshold (line 562)

void set_compress_threshold( interger $thresh)

Sets the compression threshold

Parameters

  • interger $thresh: Threshold to compress if larger than

Info

  • access - public

Method set_debug (line 579)

void set_debug( boolean $dbg)

Sets the debug flag

Parameters

  • boolean $dbg: TRUE for debugging, FALSE otherwise

Info

  • see - memcahced::memcached
  • access - public

Method set_servers (line 596)

void set_servers( array $list)

Sets the server list to distribute key gets and puts between

Parameters

  • array $list: Array of servers to connect to

Info

Inherited Variables

Inherited Class Variable Summary

Inherited Methods

Inherited Method Summary


Documentation generated on Wed, 8 Oct 2003 14:26:57 -0400 by phpDocumentor 1.2.2