-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Slamdunk/support-persistence-3
Add support for `doctrine/cache:v2`
- Loading branch information
Showing
13 changed files
with
309 additions
and
323 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Roave\PsrContainerDoctrine\Cache; | ||
|
||
use Psr\Cache\CacheItemInterface; | ||
use Psr\Cache\CacheItemPoolInterface; | ||
|
||
final class NullCache implements CacheItemPoolInterface | ||
{ | ||
public function getItem(string $key): CacheItemInterface | ||
{ | ||
return new NullCacheItem($key); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getItems(array $keys = []): iterable | ||
{ | ||
foreach ($keys as $key) { | ||
yield $key => $this->getItem($key); | ||
} | ||
} | ||
|
||
public function hasItem(string $key): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function clear(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function deleteItem(string $key): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function deleteItems(array $keys): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function save(CacheItemInterface $item): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function saveDeferred(CacheItemInterface $item): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function commit(): bool | ||
{ | ||
return true; | ||
} | ||
} |
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,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Roave\PsrContainerDoctrine\Cache; | ||
|
||
use DateInterval; | ||
use DateTimeInterface; | ||
use Psr\Cache\CacheItemInterface; | ||
|
||
final class NullCacheItem implements CacheItemInterface | ||
{ | ||
public function __construct( | ||
private readonly string $key, | ||
) { | ||
} | ||
|
||
public function getKey(): string | ||
{ | ||
return $this->key; | ||
} | ||
|
||
public function get(): mixed | ||
{ | ||
return null; | ||
} | ||
|
||
public function isHit(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function set(mixed $value): static | ||
{ | ||
return $this; | ||
} | ||
|
||
public function expiresAt(DateTimeInterface|null $expiration): static | ||
{ | ||
return $this; | ||
} | ||
|
||
public function expiresAfter(int|DateInterval|null $time): static | ||
{ | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.