private function error_recently_sent() { Loader::load('utility', "memcache/MemCache"); if (!EAMemCache::isAvailable()) { //error_log("memcache not available for ErrorHandler. no email alert sent"); return true; } $result = EAMemCache::get($this->getMemCacheKey(), time()); if (isset($result) && $result > strtotime("-10 minutes")) { //error_log("error has been emailed in the last X minutes. do not sent email alert. $memCacheKey - $result"); return true; } //error_log("update/set current error. $memCacheKey - $result"); EAMemCache::set($this->getMemCacheKey(), time()); return false; }
private final function loadFromPrimaryKeys($random = null) { $primary_key = $this->get_primary_key(); if (isset($primary_key)) { $primary_keys = $this->getPrimaryKeys(); $managed_objects = array(); foreach ((array) $primary_keys as $key) { //error_log("create with key: $key"); $object = $this->create_managed_object_with_primary_value($key); if ($this->managedObjectAllowsMemcache()) { $managed_objects[$object->getMemcacheKey()] = $object; } else { $managed_objects[] = $object; } } if ($this->managedObjectAllowsMemcache() && count($managed_objects)) { //error_log(print_r($memcache_keys,true)); $memcache_data = EAMemCache::get(array_keys($managed_objects)); //error_log(print_r(array_keys($memcache_data),true)); //error_log("managed object keys: " . print_r(array_keys($managed_objects),true)); foreach ($managed_objects as $key => $managed_object) { if (isset($memcache_data[$key]) && is_object($memcache_data[$key])) { // error_log("load from sql result..."); $managed_object->load_from_sql_result($memcache_data[$key]); } //else // error_log("$key not found"); } } $this->managed_objects = array_values($managed_objects); } //else //error_log("primary key is not defined!"); }