Skip to content

Commit

Permalink
- Fix trailing slash + keying issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEssex committed Jun 22, 2020
1 parent 937bc17 commit e331757
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use DateInterval;
use DateTime;
use Psr\SimpleCache\CacheInterface;
use function file_exists;
use function str_replace;

/**
* Class FileCache
Expand Down Expand Up @@ -142,9 +144,7 @@ public function set($key, $value, $ttl = null): bool
*/
private function _getPath(string $key): string
{
if (substr($key, -1) === '/') {
$key = substr($key, 0, -1);
}
$key = str_replace('/', '', $key);

return $this->_directoryPath . $key;
}
Expand Down Expand Up @@ -279,10 +279,10 @@ public function deleteMultiple($keys)
*/
public function has($key): bool
{
$path = $this->_getPath($key);
$keyOriginal = $key;
$key = $this->_generateKey($key);
$key = $this->_generateKey($key);
$this->_validateKey($key);
$path = $this->_getPath($key);

if (! $this->_checkFileIsNotAtEndOfLife($path, $keyOriginal)) {
return false;
Expand Down

0 comments on commit e331757

Please sign in to comment.