abstract class Messaging_Cached_Object in Messaging 6.4
Class with static caching
Hierarchy
- class \Messaging_Object extends \Messaging_User_Object
- class \Messaging_Cached_Object
Expanded class hierarchy of Messaging_Cached_Object
File
- includes/
messaging_object.class.inc, line 277 - Drupal Messaging Framework - Base classes
View source
abstract class Messaging_Cached_Object extends Messaging_Object {
/**
* Load object by unique key, may have static caching
*/
public static function object_load($table, $key, $value, $class) {
$cached = self::object_cache_get($class, $value);
if (isset($cached)) {
return $cached;
}
elseif ($object = parent::object_load($table, $key, $value, $class)) {
$object
->cache_save();
return $object;
}
else {
self::object_cache_set($class, $value, FALSE);
}
}
/**
* /**
* Create object in database
*/
public function insert() {
$result = parent::insert();
$this
->cache_save();
return $result;
}
/**
* Delete from system and from static cache
*/
function delete() {
if ($this
->key()) {
$this
->cache_delete();
return parent::delete();
}
}
/**
* Save object to cache
*/
public function cache_save() {
$this
->cache_set($this
->key(), $this);
}
/**
* Delete object from cache
*/
public function cache_delete() {
$this
->cache_set($this
->key(), FALSE);
}
/**
* Set value into static cache
*/
protected static function object_cache_set($class_name, $key, $value) {
return messaging_static_cache_set($class_name, $key, $value);
}
/**
* Get value from static cache
*/
protected static function object_cache_get($class_name, $key) {
return messaging_static_cache_get($class_name, $key);
}
public static abstract function cache_set($key, $object);
public static abstract function cache_get($key);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Messaging_Cached_Object:: |
public | function | Delete object from cache | 1 |
Messaging_Cached_Object:: |
abstract public static | function | 1 | |
Messaging_Cached_Object:: |
public | function | Save object to cache | 1 |
Messaging_Cached_Object:: |
abstract public static | function | 1 | |
Messaging_Cached_Object:: |
function |
Delete from system and from static cache Overrides Messaging_Object:: |
||
Messaging_Cached_Object:: |
public | function |
Create object in database Overrides Messaging_Object:: |
|
Messaging_Cached_Object:: |
protected static | function | Get value from static cache | |
Messaging_Cached_Object:: |
protected static | function | Set value into static cache | |
Messaging_Cached_Object:: |
public static | function |
Load object by unique key, may have static caching Overrides Messaging_Object:: |
|
Messaging_Object:: |
protected | property | ||
Messaging_Object:: |
abstract public static | function | 1 | |
Messaging_Object:: |
abstract public static | function | ||
Messaging_Object:: |
constant | 2 | ||
Messaging_Object:: |
public static | function | Load object from DB | |
Messaging_Object:: |
abstract public static | function | ||
Messaging_Object:: |
constant | 2 | ||
Messaging_Object:: |
public | function | Check whether this object is an instance or just a template | |
Messaging_Object:: |
function | Get unike id key | ||
Messaging_Object:: |
abstract public static | function | 1 | |
Messaging_Object:: |
public static | function | Build object from template | |
Messaging_Object:: |
public | function | Save to database | |
Messaging_Object:: |
public | function | Unserialize after loading. It does nothing but can be overridden | |
Messaging_Object:: |
public | function | Update object in database | |
Messaging_Object:: |
public | function | Constructor, with predefined array of data | 1 |
Messaging_Object:: |
public | function | Magic function. Set protected properties |