Overview

Packages

  • Memcache

Classes

  • Horde_Memcache
  • Horde_Memcache_Exception
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Memcache

This class provides an API or Horde code to interact with a centrally configured memcache installation.

memcached website: http://www.danga.com/memcached/

Copyright 2007-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Horde_Memcache implements Serializable
Package: Memcache
Category: Horde
License: LGPL 2.1
Author: Michael Slusarz slusarz@horde.org
Author: Didi Rieder adrieder@sbox.tugraz.at
Located at Horde/Memcache.php
Methods summary
public
# __construct( array $params = array() )

Constructor.

Constructor.

Parameters

$params
<p>Configuration parameters: - compression: (boolean) Compress data inside memcache? DEFAULT: false - c_threshold: (integer) The minimum value length before attempting to compress. DEFAULT: none - hostspec: (array) The memcached host(s) to connect to. DEFAULT: 'localhost' - large_items: (boolean) Allow storing large data items (larger than Horde_Memcache::MAX_SIZE)? DEFAULT: true - persistent: (boolean) Use persistent DB connections? DEFAULT: false - prefix: (string) The prefix to use for the memcache keys. DEFAULT: 'horde' - port: (array) The port(s) memcache is listening on. Leave empty if using UNIX sockets. DEFAULT: 11211 - weight: (array) The weight(s) to use for each memcached host. DEFAULT: none (equal weight to all servers)</p>

Throws

Horde_Memcache_Exception
public
# _init( )

Do initialization.

Do initialization.

Throws

Horde_Memcache_Exception
public
# shutdown( )

Shutdown function.

Shutdown function.

Since

1.1.0
public boolean
# delete( string $key, integer $timeout = 0 )

Delete a key.

Delete a key.

Parameters

$key
The key.
$timeout
Expiration time in seconds.

Returns

boolean
True on success.

See

Memcache::delete()
public mixed
# get( mixed $keys )

Get data associated with a key.

Get data associated with a key.

Parameters

$keys
The key or an array of keys.

Returns

mixed

The string/array on success (return type is the type of $keys), false on failure.

See

Memcache::get()
public boolean
# set( string $key, string $var, integer $expire = 0 )

Set the value of a key.

Set the value of a key.

Parameters

$key
The key.
$var
The data to store.
$expire
$timeout Expiration time in seconds.

Returns

boolean
True on success.

See

Memcache::set()
public boolean
# replace( string $key, string $var, integer $expire = 0 )

Replace the value of a key.

Replace the value of a key.

Parameters

$key
The key.
$var
The data to store.
$expire
$timeout Expiration time in seconds.

Returns

boolean
True on success, false if key doesn't exist.

See

Memcache::replace()
public
# lock( string $key )

Obtain lock on a key.

Obtain lock on a key.

Parameters

$key
The key to lock.
public
# unlock( string $key )

Release lock on a key.

Release lock on a key.

Parameters

$key
The key to lock.
public
# flush( )

Mark all entries on a memcache installation as expired.

Mark all entries on a memcache installation as expired.

public array
# stats( )

Get the statistics output from the current memcache pool.

Get the statistics output from the current memcache pool.

Returns

array

The output from Memcache::getExtendedStats() using the current configuration values.

public string
# serialize( )

Serialize.

Serialize.

Returns

string
Serialized representation of this object.

Implementation of

Serializable::serialize()
public
# unserialize( string $data )

Unserialize.

Unserialize.

Parameters

$data
Serialized data.

Throws

Exception
Horde_Memcache_Exception

Implementation of

Serializable::unserialize()
Constants summary
integer FLAGS_RESERVED

The number of bits reserved by PHP's memcache layer for internal flag use.

The number of bits reserved by PHP's memcache layer for internal flag use.

# 16
integer LOCK_TIMEOUT

Locking timeout.

Locking timeout.

Since

1.1.1
# 30
string LOCK_SUFFIX

Suffix added to key to create the lock entry.

Suffix added to key to create the lock entry.

Since

1.1.0
# '_l'
integer MAX_SIZE

The max storage size of the memcache server. This should be slightly smaller than the actual value due to overhead. By default, the max slab size of memcached (as of 1.1.2) is 1 MB.

The max storage size of the memcache server. This should be slightly smaller than the actual value due to overhead. By default, the max slab size of memcached (as of 1.1.2) is 1 MB.

# 1000000
integer VERSION

Serializable version.

Serializable version.

# 1
API documentation generated by ApiGen