App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Memcache Class Reference

Public Member Functions

 get ($keys, $flags=null)
 
 set ($key, $value, $flag=null, $expire=0)
 
 add ($key, $value, $flag=null, $expire=0)
 
 addServer ($host)
 
 close ()
 
 connect ($host, $port=null, $timeout=1)
 
 decrement ($key, $value=1)
 
 delete ($key)
 
 flush ()
 
 get ($keys, $flags=null)
 
 increment ($key, $value=1)
 
 pconnect ($host, $port=null, $timeout=1)
 
 replace ($key, $value, $flag=null, $expire=0)
 
 set ($key, $value, $flag=null, $expire=0)
 
 setCompressThreshold ($threshold, $min_savings=0.2)
 

Static Public Member Functions

static setMockMemcache ($mock)
 

Static Public Attributes

static $mock_memcache = null
 

Detailed Description

An interface to the App Engine memory cache with an interface compatible with the "memcache" PHP extension (see http://php.net/manual/en/book.memcache.php)

All instances of this class use the same memory pool for their keys and values.

Member Function Documentation

Memcache::add (   $key,
  $value,
  $flag = null,
  $expire = 0 
)

Adds a new item to the cache. Will fail if the key is already present in the cache.

Parameters
string$keyThe key associated with the value added to the cache.
mixed$valueThe value to add to the cache.
int$flagThis parameter is present only for compatibility and is ignored.
int$expireThe delay before the item is removed from the cache. If $expire <= 2592000 then it is interpreted as the number of seconds from the time of the call to wait before removing the item from the cache. If $expire > 2592000 then it is interpreted as the absolute Unix epoch time when the value will expire.
Returns
bool true if the item was successfully added to the cache, false otherwise.
Memcache::addServer (   $host)

This function is present only for compatibility and does nothing.

Memcache::close ( )

This function is present only for compatibility and does nothing.

Memcache::connect (   $host,
  $port = null,
  $timeout = 1 
)

This function is present only for compatibility and does nothing.

Memcache::decrement (   $key,
  $value = 1 
)

Decrements a cached item's value. The value must be a int, float or string representing an integer e.g. 5, 5.0 or "5" or the call with fail.

Parameters
string$keyThe key associated with the value to decrement.
int$valueThe amount to decrement the value.
Returns
mixed On success, the new value of the item is returned. On failure, false is returned.
Memcache::delete (   $key)

Deletes an item from the cache.

Parameters
string$keyThe key associated with the item to delete.
Returns
bool true if the item was successfully deleted from the cache, false otherwise. Note that this will return false if $key is not present in the cache.
Memcache::flush ( )

Removes all items from cache.

Returns
bool true if all items were removed, false otherwise.
Memcache::get (   $keys,
  $flags = null 
)

Fetches previously stored data from the cache.

Parameters
string|string[]$keys The key associated with the value to fetch, or an array of keys if fetching multiple values.
int$flagsThis parameter is present only for compatibility and is ignored. It should return the stored flag value.
Returns
mixed On success, the string associated with the key, or an array of key-value pairs when $keys is an array. On failure, false is returned.
Memcache::increment (   $key,
  $value = 1 
)

Increments a cached item's value. The value must be a int, float or string representing an integer e.g. 5, 5.0 or "5" or the call with fail.

Parameters
string$keyThe key associated with the value to decrement.
int$valueThe amount to increment the value.
Returns
mixed On success, the new value of the item is returned. On failure, false is returned.
Memcache::pconnect (   $host,
  $port = null,
  $timeout = 1 
)

This function is present only for compatibility and does nothing.

Memcache::replace (   $key,
  $value,
  $flag = null,
  $expire = 0 
)

Replaces an existing item in the cache. Will fail if the key is not already present in the cache.

Parameters
string$keyThe key associated with the value that will be replaced in the cache.
mixed$valueThe new cache value.
int$flagThis parameter is present only for compatibility and is ignored.
int$expireThe delay before the item is removed from the cache. If $expire <= 2592000 then it is interpreted as the number of seconds from the time of the call to wait before removing the item from the cache. If $expire > 2592000 then it is interpreted as the absolute Unix epoch time when the value will expire.
Returns
bool true if the item was successfully replaced in the cache, false otherwise.
Memcache::set (   $key,
  $value,
  $flag = null,
  $expire = 0 
)

Sets the value of a key in the cache regardless of whether it is currently present or not.

Parameters
string$keyThe key associated with the value that will be replaced in the cache.
mixed$valueThe new cache value.
int$flagThis parameter is present only for compatibility and is ignored.
int$expireThe delay before the item is removed from the cache. If $expire <= 2592000 then it is interpreted as the number of seconds from the time of the call to wait before removing the item from the cache. If $expire > 2592000 then it is interpreted as the absolute Unix epoch time when the value will expire.
Returns
bool true if the item was successfully replaced the cache, false otherwise.
Memcache::setCompressThreshold (   $threshold,
  $min_savings = 0.2 
)

This function is present only for compatibility and does nothing.


The documentation for this class was generated from the following files: