Example #1
0
 public function max($field)
 {
     $max = $this->cached('max' . $field . '.' . sha1(serialize($this->wheres)));
     if (!$max) {
         $collection = [];
         foreach ($this->cursor as $id) {
             $val = $this->store->hget('row.' . $id, $field);
             if ($val) {
                 $add = ['id' => $id, $field => $val];
                 $collection[] = $add;
             }
         }
         $collection = new Collection($collection);
         $max = $collection->max($field);
         $this->setCached('max' . $field . '.' . sha1(serialize($this->wheres)), $max);
     }
     return $max;
 }