dictionaryFlush()
dictionaryFlush(integer $theDelay)
Flush dictionary
In this trait we use the {@link Memcached::flush()} method.
Parameters
integer | $theDelay | Delay before flush. |
Memcached dictionary cache
This trait implements the virtual interface of the {@link DictionaryObject} using the {@link Memcached} class.
This trait requires the constructor, in the class that will be using it, to load the two declared data members and to handle the servers.
setEntry(mixed $theKey, mixed $theValue, integer $theLife)
Set a dictionary entry
In this trait we use the {@link Memcached::set()} method to add entries to the dictionary. This method will receive two kinds of objects:
The method expects the parameters to be correctly casted.
mixed | $theKey | Entry key. |
mixed | $theValue | Entry value. |
integer | $theLife | Entry lifetime. |
setEntriesByArray(array $theEntries, integer $theLife)
Set a list dictionary entries from an array
In this trait we use the {@link Memcached::setMulti()} method to add entries to the dictionary. This method will receive two kinds of objects:
The method expects the parameters to be correctly casted.
array | $theEntries | Entries array. |
integer | $theLife | Entry lifetime. |
setEntriesByIterator(\OntologyWrapper\traits\Iterator $theEntries, integer $theLife)
Set a list of dictionary entries from an iterator
In this trait we use the {@link Memcached::setMulti()} method to add entries to the dictionary. This method expects an iterator indexed by entry key.
The method expects the parameters to be correctly casted.
\OntologyWrapper\traits\Iterator | $theEntries | Entries iterator. |
integer | $theLife | Entry lifetime. |
getEntry(mixed $theKey) : mixed
Get a dictionary entry
In this trait we use the {@link Memcached::get()} method to retrieve entries from the dictionary. This method will select two kinds of objects:
The method expects the parameter to be correctly casted.
mixed | $theKey | Entry key. |
Entry value or NULL.
delEntry(mixed $theKey) : boolean
Get a dictionary entry
In this trait we use the {@link Memcached::delete()} method to delete entries from the dictionary. This method will select two kinds of objects:
The method will return TRUE if the entry was deleted, FALSE if the entry was not found and raise an exception on any other error.
The method expects the parameter to be correctly casted.
mixed | $theKey | Entry key. |
TRUE deleted, FALSE not matched.