Example #1
0
 /**
  * Get all table data using memory cache
  * @param array $columns
  * @return \Illuminate\Database\Eloquent\Collection|mixed|static[]
  */
 public static function all($columns = ['*'])
 {
     $cacheName = 'activerecord.profilefield.all.' . implode('.', $columns);
     $records = MemoryObject::instance()->get($cacheName);
     if ($records === null) {
         $records = parent::all($columns);
         MemoryObject::instance()->set($cacheName, $records);
     }
     return $records;
 }
Example #2
0
 /**
  * Get all objects with query caching
  * @param $columns array
  * @return \Illuminate\Database\Eloquent\Collection
  * @throws SyntaxException
  */
 public static function all($columns = ['*'])
 {
     $cacheName = 'activercord.app.all.' . implode('.', $columns);
     $records = MemoryObject::instance()->get($cacheName);
     if ($records === null) {
         $records = parent::all($columns);
         MemoryObject::instance()->set($cacheName, $records);
     }
     if ($records === null) {
         throw new SyntaxException('Applications is not found in table "prefix_apps"!');
     }
     return $records;
 }