summaryrefslogtreecommitdiff
path: root/caches/FileCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'caches/FileCache.php')
-rw-r--r--caches/FileCache.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/caches/FileCache.php b/caches/FileCache.php
index 20323aa..de17d52 100644
--- a/caches/FileCache.php
+++ b/caches/FileCache.php
@@ -8,7 +8,9 @@ class FileCache implements CacheInterface {
protected $param;
public function loadData(){
- return unserialize(file_get_contents($this->getCacheFile()));
+ if(file_exists($this->getCacheFile())) {
+ return unserialize(file_get_contents($this->getCacheFile()));
+ }
}
public function saveData($datas){
@@ -17,7 +19,7 @@ class FileCache implements CacheInterface {
$writeStream = file_put_contents($this->getCacheFile(), serialize($datas));
if($writeStream === false) {
- throw new \Exception("Cannot write the cache... Do you have the right permissions ?");
+ throw new \Exception('Cannot write the cache... Do you have the right permissions ?');
}
return $this;