@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * @param $keyword |
|
| 133 | + * @param false|string $keyword |
|
| 134 | 134 | * @param bool $skip |
| 135 | 135 | * @return string |
| 136 | 136 | * @throws phpFastCacheIOException |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * @param $filename |
| 200 | - * @return mixed |
|
| 200 | + * @return string |
|
| 201 | 201 | */ |
| 202 | 202 | protected static function cleanFileName($filename) |
| 203 | 203 | { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * @param $path |
|
| 215 | + * @param string $path |
|
| 216 | 216 | * @param bool $create |
| 217 | 217 | * @throws phpFastCacheIOException |
| 218 | 218 | */ |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | - * @param $file |
|
| 252 | + * @param string $file |
|
| 253 | 253 | * @return string |
| 254 | 254 | * @throws phpFastCacheIOException |
| 255 | 255 | */ |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | protected static function cleanFileName($filename) |
| 203 | 203 | { |
| 204 | 204 | $regex = [ |
| 205 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 206 | - '/\.$/', |
|
| 207 | - '/^\./', |
|
| 205 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 206 | + '/\.$/', |
|
| 207 | + '/^\./', |
|
| 208 | 208 | ]; |
| 209 | 209 | $replace = ['-', '', '']; |
| 210 | 210 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5( |
| 297 | 297 | str_shuffle(uniqid($this->getDriverName(), false)) |
| 298 | 298 | . str_shuffle(uniqid($this->getDriverName(), false)) |
| 299 | - )); |
|
| 299 | + )); |
|
| 300 | 300 | |
| 301 | 301 | $f = fopen($tmpFilename, 'w+'); |
| 302 | 302 | flock($f, LOCK_EX); |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $stat->setData(implode(', ', array_keys($this->itemInstances))) |
| 341 | - ->setRawData([ |
|
| 341 | + ->setRawData([ |
|
| 342 | 342 | 'tmp' => $this->tmp |
| 343 | - ]) |
|
| 344 | - ->setSize(Directory::dirSize($path)) |
|
| 345 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 343 | + ]) |
|
| 344 | + ->setSize(Directory::dirSize($path)) |
|
| 345 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 346 | 346 | |
| 347 | 347 | return $stat; |
| 348 | 348 | } |
@@ -17,10 +17,8 @@ |
||
| 17 | 17 | use phpFastCache\Core\Pool\DriverBaseTrait; |
| 18 | 18 | use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 19 | 19 | use phpFastCache\Core\Pool\IO\IOHelperTrait; |
| 20 | -use phpFastCache\Entities\driverStatistic; |
|
| 21 | 20 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 22 | 21 | use phpFastCache\Exceptions\phpFastCacheDriverException; |
| 23 | -use phpFastCache\Exceptions\phpFastCacheIOException; |
|
| 24 | 22 | use phpFastCache\Util\Directory; |
| 25 | 23 | use Psr\Cache\CacheItemInterface; |
| 26 | 24 | |
@@ -18,10 +18,8 @@ |
||
| 18 | 18 | use phpFastCache\Core\Pool\DriverBaseTrait; |
| 19 | 19 | use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use phpFastCache\Core\Pool\IO\IOHelperTrait; |
| 21 | -use phpFastCache\Entities\driverStatistic; |
|
| 22 | 21 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 23 | 22 | use phpFastCache\Exceptions\phpFastCacheDriverException; |
| 24 | -use phpFastCache\Util\Directory; |
|
| 25 | 23 | use Psr\Cache\CacheItemInterface; |
| 26 | 24 | |
| 27 | 25 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * @param $keyword |
|
| 212 | + * @param string $keyword |
|
| 213 | 213 | * @param bool $reset |
| 214 | 214 | * @return PDO |
| 215 | 215 | */ |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * @param \Psr\Cache\CacheItemInterface $item |
| 249 | - * @return mixed |
|
| 249 | + * @return boolean |
|
| 250 | 250 | * @throws \InvalidArgumentException |
| 251 | 251 | */ |
| 252 | 252 | protected function driverWrite(CacheItemInterface $item) |
@@ -16,15 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | use PDO; |
| 18 | 18 | use PDOException; |
| 19 | -use phpFastCache\Core\Item\ExtendedCacheItemInterface; |
|
| 20 | 19 | use phpFastCache\Core\Pool\DriverBaseTrait; |
| 21 | 20 | use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 22 | 21 | use phpFastCache\Core\Pool\IO\IOHelperTrait; |
| 23 | -use phpFastCache\Entities\driverStatistic; |
|
| 24 | 22 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 25 | -use phpFastCache\Exceptions\phpFastCacheDriverException; |
|
| 26 | 23 | use phpFastCache\Exceptions\phpFastCacheIOException; |
| 27 | -use phpFastCache\Util\Directory; |
|
| 28 | 24 | use Psr\Cache\CacheItemInterface; |
| 29 | 25 | |
| 30 | 26 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
| 155 | 155 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
| 156 | - PDO::ERRMODE_EXCEPTION); |
|
| 156 | + PDO::ERRMODE_EXCEPTION); |
|
| 157 | 157 | |
| 158 | 158 | if ($createTable == true) { |
| 159 | 159 | $this->initIndexing($PDO); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // look for keyword |
| 189 | 189 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
| 190 | 190 | $stm->execute([ |
| 191 | - ':keyword' => $keyword, |
|
| 191 | + ':keyword' => $keyword, |
|
| 192 | 192 | ]); |
| 193 | 193 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 194 | 194 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | $db = $this->currentDB; |
| 201 | 201 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
| 202 | 202 | $stm->execute([ |
| 203 | - ':keyword' => $keyword, |
|
| 204 | - ':db' => $db, |
|
| 203 | + ':keyword' => $keyword, |
|
| 204 | + ':db' => $db, |
|
| 205 | 205 | ]); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | if ($toWrite == true) { |
| 273 | 273 | try { |
| 274 | 274 | $stm = $this->getDb($item->getKey()) |
| 275 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 275 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 276 | 276 | $stm->execute([ |
| 277 | - ':keyword' => $item->getKey(), |
|
| 278 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 279 | - ':exp' => time() + $item->getTtl(), |
|
| 277 | + ':keyword' => $item->getKey(), |
|
| 278 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 279 | + ':exp' => time() + $item->getTtl(), |
|
| 280 | 280 | ]); |
| 281 | 281 | |
| 282 | 282 | return true; |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | try { |
| 286 | 286 | $stm = $this->getDb($item->getKey(), true) |
| 287 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 287 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 288 | 288 | $stm->execute([ |
| 289 | - ':keyword' => $item->getKey(), |
|
| 290 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 291 | - ':exp' => time() + $item->getTtl(), |
|
| 289 | + ':keyword' => $item->getKey(), |
|
| 290 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 291 | + ':exp' => time() + $item->getTtl(), |
|
| 292 | 292 | ]); |
| 293 | 293 | } catch (PDOException $e) { |
| 294 | 294 | return false; |
@@ -310,20 +310,20 @@ discard block |
||
| 310 | 310 | { |
| 311 | 311 | try { |
| 312 | 312 | $stm = $this->getDb($item->getKey()) |
| 313 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 313 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 314 | 314 | $stm->execute([ |
| 315 | - ':keyword' => $item->getKey(), |
|
| 316 | - ':U' => time(), |
|
| 315 | + ':keyword' => $item->getKey(), |
|
| 316 | + ':U' => time(), |
|
| 317 | 317 | ]); |
| 318 | 318 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 319 | 319 | |
| 320 | 320 | } catch (PDOException $e) { |
| 321 | 321 | try { |
| 322 | 322 | $stm = $this->getDb($item->getKey(), true) |
| 323 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 323 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 324 | 324 | $stm->execute([ |
| 325 | - ':keyword' => $item->getKey(), |
|
| 326 | - ':U' => time(), |
|
| 325 | + ':keyword' => $item->getKey(), |
|
| 326 | + ':U' => time(), |
|
| 327 | 327 | ]); |
| 328 | 328 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 329 | 329 | } catch (PDOException $e) { |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | if ($item instanceof Item) { |
| 352 | 352 | try { |
| 353 | 353 | $stm = $this->getDb($item->getKey()) |
| 354 | - //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
| 355 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 354 | + //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
| 355 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 356 | 356 | |
| 357 | 357 | return $stm->execute([ |
| 358 | 358 | // ':id' => $row[ 'id' ], |
| 359 | - ':keyword' => $item->getKey(), |
|
| 360 | - ':U' => time(), |
|
| 359 | + ':keyword' => $item->getKey(), |
|
| 360 | + ':U' => time(), |
|
| 361 | 361 | ]); |
| 362 | 362 | } catch (PDOException $e) { |
| 363 | 363 | return false; |