1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-26 06:24:32 +02:00

feat(admin-plugin): YAML parsing will be cached in production #263

This commit is contained in:
Awilum
2019-10-15 23:17:07 +03:00
parent 76f49521e6
commit 94d9bfb011

View File

@@ -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);