Class CacheSet

Description

Quasi-equivalent (superior in some repects) to Java's HashSet. Uses memcached as a storage mechanism for persisting set data beyond the scope of the current request.

Located in /CacheSet.php (line 47)


	
			
Direct descendents
Class Description
LinkedCacheSet Quasi-equivalent (superior in some repects) to Java's LinkedHashSet. Uses memcached as a storage mechanism for persisting set data beyond the scope of the current request.
Variable Summary
string $name
array $set
Method Summary
CacheSet __construct (string $name)
void __destruct ()
void add (mixed $value)
boolean contains (mixed $key)
array &copy ()
mixed delete (mixed $key)
mixed get (mixed $key)
int indexOf (mixed $key)
boolean isEmpty ()
void load ()
void purge ()
void save ()
void set (mixed $key, mixed $value)
int size ()
boolean sort ([boolean $keepAssoc = false], [boolean $reverseOrder = false])
boolean sortByKey ([boolean $reverseOrder = false])
void update ( &$set, mixed $set)
mixed valueOf (mixed $key)
Variables
Cache $cache (line 52)
  • access: protected
string $name (line 57)
  • access: protected
array $set (line 62)
  • access: protected
Methods
Constructor __construct (line 69)

Class constructor

  • access: public
CacheSet __construct (string $name)
  • string $name

Redefined in descendants as:
Destructor __destruct (line 78)

Class destructor

  • access: public
void __destruct ()

Redefined in descendants as:
add (line 85)

Adds the specified element to the end of the set.

  • access: public
void add (mixed $value)
  • mixed $value

Redefined in descendants as:
  • LinkedCacheSet::add() : Adds the specified element to the end of the set. The internal pointer is updated to the position of the element (last in the set).
contains (line 97)

Returns true if the specified element is contained within the set, or false otherwise.

  • access: public
boolean contains (mixed $key)
  • mixed $key
copy (line 111)

Creates a copy (clone) of the internal set. As changes to the copy are not persisted in the cache, this is used mainly for performing read/sort operations externally on the set.

  • access: public
array &copy ()
delete (line 122)

Deletes and returns the specified element from the set, or returns null if the element does not exist.

  • access: public
mixed delete (mixed $key)
  • mixed $key

Redefined in descendants as:
  • LinkedCacheSet::delete() : Deletes and returns the specified element from the set, or returns null if the element does not exist. The internal pointer is updated to the first element in the set.
get (line 139)

Returns the specified element from the set, or null if the element does not exist.

  • access: public
mixed get (mixed $key)
  • mixed $key
indexOf (line 150)

Returns the index of the element referenced by the specified key from the set, or -1 if the key does not exist.

  • access: public
int indexOf (mixed $key)
  • mixed $key
isEmpty (line 166)

Returns whether or not the set is empty.

  • access: public
boolean isEmpty ()
load (line 173)

Retrieves the internal set from the cache.

  • access: protected
void load ()
purge (line 180)

Deletes the internal set from the cache.

  • access: public
void purge ()
save (line 188)

Persists the internal set to the cache.

  • access: protected
void save ()
set (line 201)

Updates the specified element's value within the set.

  • access: public
void set (mixed $key, mixed $value)
  • mixed $key
  • mixed $value

Redefined in descendants as:
  • LinkedCacheSet::set() : Updates the specified element's value within the set. The internal pointer is updated to the position of the element.
size (line 211)

Returns the number of elements in the set.

  • access: public
int size ()
sort (line 224)

CacheSet's internal sorting facility, which uses PHP's array value sorting functions. The default assumes a non-associative set, and sorts in ascending order of values.

  • access: public
boolean sort ([boolean $keepAssoc = false], [boolean $reverseOrder = false])
  • boolean $keepAssoc: = false
  • boolean $reverseOrder: = false
sortByKey (line 252)

CacheSet's internal sorting facility, which uses PHP's array key sorting functions. The default sorts in ascending order of keys.

  • access: public
boolean sortByKey ([boolean $reverseOrder = false])
  • boolean $reverseOrder: = false
update (line 269)

Updates the internal set. Useful in conjunction with copy() if advanced sorting operations are required on the set - simply use copy() to create a local clone of the set, perform the necessary operations on the clone, then use update() to refresh the structure and contents of the set.

  • access: public
void update ( &$set, mixed $set)
  • mixed $set
  • &$set
valueOf (line 281)

Returns the value of the element referenced by the specified key from the set, or null if the key does not exist.

  • access: protected
mixed valueOf (mixed $key)
  • mixed $key

Documentation generated on Thu, 14 Feb 2008 09:14:27 -0500 by phpDocumentor 1.4.1