$mPid
$mPid : string
Dictionary identifier.
This data member holds the dictionary identifier.
Dictionary
This class implements a concrete instance of the {@link DictionaryObject} class which uses the {@link MemcachedDictionary} trait to implement the dictionary cache.
This class implements a constructor which expects the {@link Memcached} persistent identifier and the list of servers.
__construct(mixed $theIdentifier, array $theServers)
Instantiate class.
The constructor accepts two parameters:
The constructor will first instantiate the {@link Memcached} object, then it will check if the connection resource has already a list of servers associated, if that is the case we assume the cache is already initialised; if that is not the case, we will add the servers provided in the second parameter.
mixed | $theIdentifier | Persistent identifier. |
array | $theServers | List of servers. |
setTag(mixed $theTag, integer $theLife)
Set tag
This method should commit the provided tag, both as an identifier and as an object.
The method expects the following parameters:
mixed | $theTag | Tag object. |
integer | $theLife | Element lifetime. |
setTagsByIterator(\OntologyWrapper\ObjectIterator $theTags, integer $theLife)
Set tags by iterator
This method should commit the provided tags, both as identifiers and as an objects.
The method expects the following parameters:
\OntologyWrapper\ObjectIterator | $theTags | Tag iterator. |
integer | $theLife | Elements lifetime. |
getSerial(string $theIdentifier, boolean $doAssert) : integer
Get serial number
This method should return the serial identifier corresponding to the provided persistent identifier.
The second parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will return NULL on a mismatch. By default this option is TRUE.
string | $theIdentifier | Persistent identifier. |
boolean | $doAssert | If TRUE assert match. |
Sequence number or NULL. +
getObject(string $theIdentifier, boolean $doAssert) : mixed
Get object
This method should return the tag object corresponding to the provided serial identifier.
The second parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will return NULL on a mismatch. By default this option is TRUE.
string | $theIdentifier | Serial identifier. |
boolean | $doAssert | If TRUE assert match. |
Tag object array or NULL.
getTypes(string $theIdentifier, string $theType, array $theKind, mixed $theMin, mixed $theMax, string $thePattern, boolean $doAssert) : boolean
Get tag types
This method should return the tag data type, kind, range and pattern in the provided reference parameters, the method expects the identifier to be a tag sequence number, it will be cast to an integer.
The last parameter represents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception; if FALSE, the method will set the data type to NULL, the data kind to an empty array, the range to an empty array and the pattern to NULL.
string | $theIdentifier | Serial identifier. |
string | $theType | Receives data type. |
array | $theKind | Receives data kind. |
mixed | $theMin | Receives minimum data range. |
mixed | $theMax | Receives maximum data range. |
string | $thePattern | Receives data pattern. |
boolean | $doAssert | If TRUE assert match. |
TRUE means the tag was found.
getTagOffsets() : array
Get dictionary tag offsets
This method should return the list of tag sequence numbers corresponding to the tag properties that will be stored in the dictionary.
By default we store:
Other properties are either not needed for this purpose, or they are modified frequently, making reading from the database slower, but safer.
The method will return an array suited to be used for querying with a field selection, the tag offsets are the key and a boolean is the value.
List of tag offsets.
delTag(mixed $theIdentifier, boolean $doAssert) : boolean
Delete tag
This method should delete a tag entry corresponding to the provided persistent or serial identifier. This means that the method will delete both the identifier and the object entries.
Note that an integer identifier is assumed to be the serial identifier and anything else will be cast to string and assumed to be the persistent identifier.
The second parameter rperesents a boolean flag: if TRUE and the provided identifier is not matched, the method will raise an exception. By default this option is FALSE.
mixed | $theIdentifier | Persistent or serial identifier. |
boolean | $doAssert | If TRUE assert match. |
TRUE deleted, FALSE not found.
dictionaryFilled() : boolean
Check if dictionary is filled
This method will return TRUE if the current dictionary can resolve the kTAG_ROLES identifier.
We assume that if the dictionary can resolve this identifier, it means it must be filled.
We check whether the {@link kTAG_ROLES} serial resolved to the correct tag object.
TRUE means filled.
dictionaryFlush(integer $theDelay)
Flush dictionary elements
This method should invalidate all the elements of the dictionary.
The method expects one parameter that corresponds to the delay in seconds before the elements will be invalidated.
integer | $theDelay | Delay before flush. |
offsetGet(mixed $theOffset) : mixed
Return a value at a given offset
We overload this method to call the preflight method: if it returns NULL we call the parent method; if not, we return the received value.
We also overload this method to handle unmatched offsets: we prevent warnings from being issued and return NULL.
mixed | $theOffset | Offset. |
Offset value or NULL.
offsetSet(string $theOffset, mixed $theValue)
Set a value at a given offset
We overload this method to call the preflight and postflight methods: if the preflight method returns NULL we call the parent method; if not, we stop.
We also overload this method to handle NULL values: in that case we delete the offset.
string | $theOffset | Offset. |
mixed | $theValue | Value to set at offset. |
offsetUnset(string $theOffset)
Reset a value at a given offset
We overload this method to call the preflight and postflight methods: if the preflight method returns NULL we call the parent method; if not, we stop.
We also overload this method to prevent warnings on unmatched offsets.
string | $theOffset | Offset. |
Object2Array(\OntologyWrapper\reference $theSource, \OntologyWrapper\reference $theDestination)
<h4>Convert object to array</h4>
This method can be used to obtain an array of arrays from a nested structure.
The method expects as the first parameter a reference to an {@link ArrayObject} or to an array, it will convert the provided parameter to an array and traverse it, converting recursively any {@link ArrayObject} instance into an array.
The method accepts the following parameters:
\OntologyWrapper\reference | $theSource | Reference to the source structure. |
\OntologyWrapper\reference | $theDestination | Reference to the destination array. |
setEntry(mixed $theKey, mixed $theValue, integer $theLife)
Set a dictionary entry
This method should commit a new entry in the dictionary, if it doesn't exist yet, or replace the matching entry if it already exists.
The method expects the following parameters:
If the operation fails the method should raise an exception.
mixed | $theKey | Entry key. |
mixed | $theValue | Entry value. |
integer | $theLife | Entry lifetime. |
getEntry(mixed $theKey) : mixed
Get a dictionary entry
This method should return the dictionary entry corresponding to the provided key; if the entry is not matched, the method should return NULL.
If the operation fails the method should raise an exception.
mixed | $theKey | Entry key. |
Entry value or NULL.
delEntry(mixed $theKey) : boolean
Get a dictionary entry
This method should delete the dictionary entry corresponding to the provided key; if the entry was deleted, the method should return TRUE, if the entry was not found, the method should return FALSE.
If the operation fails the method should raise an exception.
mixed | $theKey | Entry key. |
TRUE deleted, FALSE not matched.
preOffsetExists(\OntologyWrapper\reference $theOffset) : mixed
Handle offset before checking it
This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetExists()} method.
The method provides the offset as a reference, if the method returns NULL it means that the offset must be passed to the inherited {@link ArrayObject::OffsetExists()}; if the method returns any other value, this will be returned and the inherited {@link ArrayObject::OffsetExists()} will be skipped.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |
NULL check offset, other, return.
preOffsetGet(\OntologyWrapper\reference $theOffset) : mixed
Handle offset before getting it
This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetGet()} method.
The method provides the offset as a reference, if the method returns NULL it means that the offset must be passed to the inherited {@link ArrayObject::OffsetGet()}; if the method returns any other value, this must be returned and the inherited {@link ArrayObject::OffsetGet()} skipped.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |
NULL get offset value, other, return.
preOffsetSet(\OntologyWrapper\reference $theOffset, \OntologyWrapper\reference $theValue) : mixed
Handle offset and value before setting it
This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetSet()} method.
The method provides the offset and value as references, if the method returns NULL it means that the offset and value must be passed to the inherited {@link ArrayObject::OffsetSet()}; if the method returns any other value, this means that the inherited {@link ArrayObject::OffsetSet()} should be skipped.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |
\OntologyWrapper\reference | $theValue | Offset value reference. |
NULL set offset value, other, return.
postOffsetSet(\OntologyWrapper\reference $theOffset, \OntologyWrapper\reference $theValue)
Handle offset and value after setting it
This method can be used to manage the object after calling the {@link ArrayObject::OffsetSet()} method.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |
\OntologyWrapper\reference | $theValue | Offset value reference. |
preOffsetUnset(\OntologyWrapper\reference $theOffset) : mixed
Handle offset and value before deleting it
This method can be used to manage the offset before passing it to the inherited {@link ArrayObject::OffsetUnset()} method.
The method provides the offset as reference, if the method returns NULL it means that the offset and value must be passed to the inherited {@link ArrayObject::OffsetUnset()}; if the method returns any other value, this means that the inherited {@link ArrayObject::OffsetUnset()} should be skipped.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |
NULL delete offset value, other, return.
postOffsetUnset(\OntologyWrapper\reference $theOffset)
Handle offset after deleting it
This method can be used to manage the object after calling the {@link ArrayObject::OffsetUnset()} method.
In this class we do nothing.
\OntologyWrapper\reference | $theOffset | Offset reference. |