Core_ObjectWatcher
in package
Implement an Identity Map pattern
Tags
Table of Contents
Properties
- $config : mixed
- ObjectWatcher config
- $_maxObjects : array<string|int, mixed>
- Maximum count of objects Максимальное количество объектов
- $_cache : array<string|int, mixed>
- Cache
- $_instance : mixed
- The singleton instance.
Methods
- add() : mixed
- Add instance of $model to cahce
- clear() : mixed
- Clear all instances
- delete() : mixed
- Delete instance of $model from cahce
- exists() : mixed
- Checks if instance of $classname already exist
- getKey() : string
- Get primary key of model
- instance() : object
- Register an existing instance as a singleton.
- reduce() : mixed
- Reduce cache
- __construct() : mixed
- Constructor.
Properties
$config
ObjectWatcher config
public
static mixed
$config
= \NULL
$_maxObjects
Maximum count of objects Максимальное количество объектов
protected
static array<string|int, mixed>
$_maxObjects
= \NULL
$_cache
Cache
private
array<string|int, mixed>
$_cache
= array()
$_instance
The singleton instance.
private
static mixed
$_instance
Methods
add()
Add instance of $model to cahce
public
static add(Core_Entity $model) : mixed
Parameters
- $model : Core_Entity
clear()
Clear all instances
public
static clear() : mixed
delete()
Delete instance of $model from cahce
public
static delete(Core_Entity $model) : mixed
Parameters
- $model : Core_Entity
exists()
Checks if instance of $classname already exist
public
static exists(string $classname, string $primaryKey) : mixed
Parameters
- $classname : string
-
class name
- $primaryKey : string
-
primary key
getKey()
Get primary key of model
public
getKey(Core_Entity $model) : string
Parameters
- $model : Core_Entity
-
object
Return values
stringinstance()
Register an existing instance as a singleton.
public
static instance() : object
Return values
objectreduce()
Reduce cache
public
reduce() : mixed
__construct()
Constructor.
private
__construct() : mixed