コード例 #1
0
 public static function find($parameters = null)
 {
     //Create an unique key based on the parameters
     $key = self::_createKey($parameters);
     if (!isset(self::$_cache[$key])) {
         //Store the result in the memory cache
         self::$_cache[$key] = parent::find($parameters);
     }
     //Return the result in the cache
     return self::$_cache[$key];
 }
コード例 #2
0
 public static function find($parameters = null)
 {
     //Convert the parameters to an array
     if (!is_array($parameters)) {
         $parameters = array($parameters);
     }
     //Check if a cache key wasn't passed
     //and create the cache parameters
     if (!isset($parameters['cache'])) {
         $parameters['cache'] = array("key" => self::_createKey($parameters), "lifetime" => 300);
     }
     return parent::find($parameters);
 }
コード例 #3
0
 public static function find($parameters = null)
 {
     //Create a unique key
     $key = self::_createKey($parameters);
     //Check if there are data in the cache
     $results = self::_getCache($key);
     // Valid data is an object
     if (is_object($results)) {
         return $results;
     }
     $results = array();
     $invoices = parent::find($parameters);
     foreach ($invoices as $invoice) {
         //Query the related customer
         $customer = $invoice->customer;
         //Assign it to the record
         $invoice->customer = $customer;
         $results[] = $invoice;
     }
     //Store the invoices in the cache + their customers
     self::_setCache($key, $results);
     return $results;
 }
コード例 #4
0
 public static function find($parameters = null)
 {
     return parent::find($parameters);
 }