-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added error handling for cache system (#199)
- Loading branch information
1 parent
bb9ad85
commit 582dd72
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
/** | ||
* Bootstrap.php | ||
* | ||
* @license More in LICENSE.md | ||
* @copyright https://www.fastybird.com | ||
* @author Adam Kadlec <[email protected]> | ||
* @package FastyBird:Bootstrap! | ||
* @subpackage Boot | ||
* @since 1.0.0 | ||
* | ||
* @date 08.03.20 | ||
*/ | ||
|
||
namespace FastyBird\Library\Bootstrap\Caching; | ||
|
||
use Nette\Caching\Storages; | ||
use function dirname; | ||
use function is_dir; | ||
use function is_file; | ||
use function mkdir; | ||
|
||
class FileStorage extends Storages\FileStorage | ||
{ | ||
|
||
public function lock(string $key): void | ||
{ | ||
$cacheFile = $this->getCacheFile($key); | ||
if (!is_dir($dir = dirname($cacheFile))) { | ||
@mkdir($dir); // @ - directory may already exist | ||
} | ||
|
||
if (!is_file($cacheFile)) { | ||
return; | ||
} | ||
|
||
parent::lock($key); | ||
} | ||
|
||
} |