2 require_once(dirname(__FILE__) .
'/../Exception/class.arException.php');
28 $instance =
new $class();
30 if ($instance->getCache()->exists($instance->getCacheIdentifier())) {
35 if (!isset(self::$cache[$class])) {
38 if (!isset(self::$cache[$class][
$id]) || !self::$cache[$class][
$id] instanceof
ActiveRecord) {
42 return in_array($id, array_keys(self::$cache[$class]));
52 if ($object->getCache()->set($object->getCacheIdentifier(), $object, $object->getTTL())) {
56 if (!isset($object->is_new)) {
64 foreach (self::$cache as $class => $objects) {
80 public static function get($class,
$id)
82 $instance =
new $class();
84 if ($instance->getCache()->exists($instance->getCacheIdentifier())) {
85 return $instance->getCache()->get($instance->getCacheIdentifier());
88 if (!self::isCached($class,
$id)) {
92 return self::$cache[$class][
$id];
102 $object->getCache()->
delete($object->getCacheIdentifier());
111 public static function flush($class_name)
113 $instance =
new $class_name();
115 $instance->getCache()->flush();
119 $class_name = get_class($class_name);
121 unset(self::$cache[$class_name]);
Class CachedActiveRecord.
const GET_UNCACHED_OBJECT
if(!array_key_exists('StateId', $_REQUEST)) $id
static purge(ActiveRecord $object)
static store(ActiveRecord $object)
static flush($class_name)
static isCached($class, $id)