/**
  * @return \yii\web\Response
  */
 public function actionSearch()
 {
     $model = new RedisModel();
     if ($model->load(\Yii::$app->request->post()) && $model->storeFilter()) {
         \Yii::$app->session->setFlash('success', Redisman::t('redisman', 'Search query updated!'));
         return $this->redirect(['show']);
     } else {
         \Yii::$app->session->setFlash('error', Html::errorSummary($model));
         return $this->redirect(['index']);
     }
 }
 public function testGreedySearch()
 {
     $this->module->greedySearch = true;
     $this->module->searchMethod = 'SCAN';
     $model = new RedisModel();
     $model->setAttributes(['pattern' => 'testfxt:*', 'perpage' => 10]);
     $this->assertTrue($model->storeFilter());
     $dp = $model->search(['page' => 1]);
     $this->assertTrue($dp instanceof ArrayDataProvider);
     $models1 = $dp->getModels();
     $this->assertNotEmpty($models1);
     $this->assertTrue($dp->getCount() == 10);
     $this->assertTrue($dp->getCount() == count($models1));
     $total1 = $dp->getTotalCount();
     Debug::debug($dp->getCount() . '/' . $dp->getTotalCount());
     $dp = $model->search(['page' => 2]);
     $this->assertTrue($dp instanceof ArrayDataProvider);
     $models2 = $dp->getModels();
     $total2 = $dp->getTotalCount();
     $this->assertTrue($dp->getCount() == 10);
     $this->assertTrue($dp->getCount() == count($models2));
     $this->assertEquals($total1, $total2);
     $this->assertNotEquals($models1, $models2);
     Debug::debug($dp->getCount() . '/' . $dp->getTotalCount());
     Debug::debug($models2);
     $this->module->searchMethod = 'KEYS';
     $model = new RedisModel();
     $model->setAttributes(['pattern' => 'testfxt:*', 'perpage' => 10]);
     $this->assertTrue($model->storeFilter());
     $dp = $model->search(['page' => 1]);
     $this->assertTrue($dp instanceof ArrayDataProvider);
     $models1 = $dp->getModels();
     $this->assertNotEmpty($models1);
     $this->assertTrue($dp->getCount() == 10);
     $this->assertTrue($dp->getCount() == count($models1));
     $total1 = $dp->getTotalCount();
     Debug::debug($dp->getCount() . '/' . $dp->getTotalCount());
     Debug::debug($models1);
     $dp = $model->search(['page' => 2]);
     $this->assertTrue($dp instanceof ArrayDataProvider);
     $models2 = $dp->getModels();
     $total2 = $dp->getTotalCount();
     $this->assertNotEmpty($models2);
     $this->assertTrue($dp->getCount() == 10);
     $this->assertTrue($dp->getCount() == count($models2));
     $this->assertEquals($total1, $total2);
     $this->assertNotEquals($models1, $models2);
     Debug::debug($dp->getCount() . '/' . $dp->getTotalCount());
     Debug::debug($models2);
 }