Identity Map object.
Helps prevent duplication of objects within the system, preventing bugs with overwriting changes etc. All watched objects should return a unique string (usually it will actually be an integer, but strings are supported). via a getID() method.
package | dstruct_common |
---|
add(object $obj)
object
exists(string $classname, string $id) : mixed
This takes class name and id as the check should be made before the new object would have been instanced!
string
string
mixed
The object, if it is found, or false.getCacheHits() : integer
integer
getObjectCount() : integer
todo | changed - needs checking |
---|
integer
instance() : object
object
remove(object $obj) : boolean
object
boolean
True on success, false if object not found.__construct()
globalKey(object $obj) : string
Watched objects are identified by their class and their ID
object
string
$cachehits : integer
$instance : object
$objs : array