Skip to content

Commit

Permalink
add file cache
Browse files Browse the repository at this point in the history
  • Loading branch information
white-poto committed Jun 22, 2016
1 parent 823283a commit 5d72aa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cache/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function setItem($key, $value, $time, $expire)
if ($cache_file === false) return false;

$cache_data = array('data' => $value, 'time' => $time, 'expire' => $expire);
$cache_data = json_encode($cache_data);
$cache_data = serialize($cache_data);

$put_result = file_put_contents($cache_file, $cache_data);
if ($put_result === false) return false;
Expand Down Expand Up @@ -232,7 +232,7 @@ protected function getItem($key)

$cache_data = file_get_contents($cache_file);
if (empty($cache_data)) return false;
$cache_data = json_decode($cache_data, true);
$cache_data = unserialize($cache_data);
if ($cache_data) {
$check_expire = $this->checkExpire($cache_data);
if ($check_expire === false) {
Expand Down

0 comments on commit 5d72aa9

Please sign in to comment.