Skip to content

Commit 32c035c

Browse files
committed
Remove hard cache
1 parent 5928926 commit 32c035c

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/actions/PageView.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use nullref\cms\models\Page;
66
use Yii;
77
use yii\base\Action;
8-
use yii\caching\Cache;
98
use yii\web\NotFoundHttpException;
109

1110

@@ -16,9 +15,7 @@
1615
class PageView extends Action
1716
{
1817
public $view = 'view';
19-
20-
public $cachePrefix = 'cms.page.';
21-
18+
2219
public function run()
2320
{
2421
if (($route = Yii::$app->request->getQueryParam('route')) == null) {
@@ -32,22 +29,16 @@ public function run()
3229
throw new NotFoundHttpException(Yii::t('cms', 'Page not found.'));
3330
}
3431

35-
/** @var Cache $cache */
36-
$cache = Yii::$app->getCache();
37-
38-
if (($result = $cache->get($this->cachePrefix . $route)) === false) {
39-
if ($page->layout) {
40-
$this->controller->layout = $page->layout;
41-
}
42-
if ($page->type == Page::TYPE_CONTENT) {
43-
$this->view = 'content-view';
44-
}
45-
$result = $this->controller->render($this->view, [
46-
'page' => $page,
47-
]);
48-
$cache->set($this->cachePrefix . $route, $result);
32+
if ($page->layout) {
33+
$this->controller->layout = $page->layout;
34+
}
35+
if ($page->type == Page::TYPE_CONTENT) {
36+
$this->view = 'content-view';
4937
}
38+
$result = $this->controller->render($this->view, [
39+
'page' => $page,
40+
]);
5041

5142
return $result;
5243
}
53-
}
44+
}

0 commit comments

Comments
 (0)