-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add psr-16 implementation #77
Conversation
d8b4cab
to
41c6349
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes
src/Bridges/Psr/Cache.php
Outdated
/** | ||
* @return Generator<string, mixed> | ||
*/ | ||
public function getMultiple(iterable $keys, mixed $default = null): iterable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok, like Generator?
src/Bridges/Psr/Cache.php
Outdated
|
||
public function clear(): bool | ||
{ | ||
$this->storage->clean([Nette\Caching\Cache::All => true]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method clear is missing in tests.
@@ -23,7 +23,8 @@ | |||
"nette/di": "^3.1 || ^4.0", | |||
"latte/latte": "^3.0.12", | |||
"tracy/tracy": "^2.9", | |||
"phpstan/phpstan": "^1.0" | |||
"phpstan/phpstan": "^1.0", | |||
"psr/simple-cache": "^2.0 || ^3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add dependency for version 1.0.
3bc4e14
to
d31b325
Compare
@JanTvrdik I squashed all commits, thank you. |
d31b325
to
15eaa3d
Compare
What is next step? |
Great, thank you |
I'm thinking, does it matter that there is no namespace support (for keys)? Or is it common in the case of PSR-16 to handle it one level up? |
Laravel has both. The base Repository implements PSR-16 does not support namespace and extends TaggedCache has namepsace. Symfony implementation PSR-16 does not use namespace. The key is delegate to pool (PSR-6) where is namespace. On one project I use namespaces, on another project I don't use namespaces and we keep all prefixes in one file like a class constants. If you want namespace. I will add optional parameter to contructor. |
I prepared PSR-16 implmentation.