From 94d9bfb011ac3ae6965948309df5908d90565f26 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 15 Oct 2019 23:17:07 +0300 Subject: [PATCH] feat(admin-plugin): YAML parsing will be cached in production #263 --- flextype/parsers/Parser.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/flextype/parsers/Parser.php b/flextype/parsers/Parser.php index f109822c..0c0b9f61 100644 --- a/flextype/parsers/Parser.php +++ b/flextype/parsers/Parser.php @@ -83,8 +83,7 @@ class Parser break; default: - return FrontmatterParser::encode($input); - + break; } } @@ -105,8 +104,8 @@ class Parser if ($cache) { $key = md5($input); - if ($this->flextype['cache']->contains($key)) { - return $this->flextype['cache']->fetch($key); + if ($data_from_cache = $this->flextype['cache']->fetch($key)) { + return $data_from_cache; } $data = FrontmatterParser::decode($input); @@ -122,8 +121,8 @@ class Parser if ($cache) { $key = md5($input); - if ($this->flextype['cache']->contains($key)) { - return $this->flextype['cache']->fetch($key); + if ($data_from_cache = $this->flextype['cache']->fetch($key)) { + return $data_from_cache; } $data = JsonParser::decode($input); @@ -139,8 +138,8 @@ class Parser if ($cache) { $key = md5($input); - if ($this->flextype['cache']->contains($key)) { - return $this->flextype['cache']->fetch($key); + if ($data_from_cache = $this->flextype['cache']->fetch($key)) { + return $data_from_cache; } $data = YamlParser::decode($input);