Exemplo n.º 1
0
 /**
  * Finds a single redis record with the specified primary key.
  * @param mixed $pk primary key value(s). Use array for multiple primary keys. For composite key, each key value must be an array (column name=>column value).
  * @return ARedisRecord the record found. Null if none is found.
  */
 public function findByPk($pk)
 {
     Yii::trace(get_class($this) . '.findByPk()', 'packages.redis.ARedisRecord');
     $this->beforeFind();
     $hash = new ARedisHash($this->getRedisKey($pk), $this->getRedisConnection());
     if ($hash->getCount() == 0) {
         return null;
     }
     return $this->populateRecord($hash->toArray(), true);
 }