Skip to content

Commit 67e1ba3

Browse files
committed
Fixed some warnings
1 parent 7eca2eb commit 67e1ba3

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/Engine/FileSystemCacheEngine.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public function set($key, $object, $ttl = 0)
100100
file_put_contents($fileKey, serialize($object));
101101
}
102102
} catch (Exception $ex) {
103-
echo "<br/><b>Warning:</b> I could not write to cache on file '" . basename($key) . "'. Switching to nocache=true mode. <br/>";
103+
$this->logger->warning("[Filesystem cache] I could not write to cache on file '" . basename($key) . "'. Switching to nocache=true mode.");
104+
return false;
104105
}
105106

106107
return true;
@@ -130,8 +131,11 @@ public function append($key, $content, $ttl = 0)
130131
try {
131132
file_put_contents($fileKey, serialize($content), true);
132133
} catch (Exception $ex) {
133-
echo "<br/><b>Warning:</b> I could not write to cache on file '" . basename($key) . "'. Switching to nocache=true mode. <br/>";
134+
$this->logger->warning("[Filesystem cache] I could not write to cache on file '" . basename($key) . "'. Switching to nocache=true mode.");
135+
return false;
134136
}
137+
138+
return true;
135139
}
136140

137141
/**

src/Engine/RedisCacheEngine.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace ByJG\Cache\Engine;
44

55
use ByJG\Cache\CacheEngineInterface;
6-
use Memcached;
76
use Psr\Log\NullLogger;
87

98
class RedisCacheEngine implements CacheEngineInterface

src/Engine/ShmopCacheEngine.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ public function get($key, $ttl = 0)
125125
*/
126126
public function set($key, $object, $ttl = 0)
127127
{
128-
129-
130128
$this->logger->info("[Shmop Cache] set '$key'");
131129

132130
$this->release($key);
@@ -155,6 +153,8 @@ public function set($key, $object, $ttl = 0)
155153
$this->logger->warning("Couldn't write the entire length of data");
156154
}
157155
shmop_close($shm_id);
156+
157+
return true;
158158
}
159159

160160
/**
@@ -178,6 +178,8 @@ public function append($key, $str)
178178
throw new InvalidArgumentException('Only is possible append string types');
179179
}
180180
}
181+
182+
return true;
181183
}
182184

183185
/**

src/Psr/CachePool.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function clear()
170170
* Psr implementation of deleteItem()
171171
*
172172
* @param string $key
173-
* @return bool|void
173+
* @return bool
174174
*/
175175
public function deleteItem($key)
176176
{
@@ -181,7 +181,7 @@ public function deleteItem($key)
181181
* Psr Implementation of deleteItems()
182182
*
183183
* @param array $keys
184-
* @return bool|void
184+
* @return bool
185185
*/
186186
public function deleteItems(array $keys)
187187
{
@@ -195,7 +195,7 @@ public function deleteItems(array $keys)
195195

196196
/**
197197
* @param CacheItemInterface $item
198-
* @return bool|void
198+
* @return bool
199199
*/
200200
public function save(CacheItemInterface $item)
201201
{
@@ -222,7 +222,7 @@ public function save(CacheItemInterface $item)
222222
* Psr Implementation of saveDeferred()
223223
*
224224
* @param CacheItemInterface $item
225-
* @return bool|void
225+
* @return bool
226226
*/
227227
public function saveDeferred(CacheItemInterface $item)
228228
{

0 commit comments

Comments
 (0)