Skip to content
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

Merged
merged 2 commits into from
Jun 3, 2024
Merged

Conversation

h4kuna
Copy link
Contributor

@h4kuna h4kuna commented May 24, 2024

I prepared PSR-16 implmentation.

@h4kuna h4kuna force-pushed the add-implementation-psr-16 branch from d8b4cab to 41c6349 Compare May 24, 2024 12:24
Copy link
Contributor Author

@h4kuna h4kuna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes

/**
* @return Generator<string, mixed>
*/
public function getMultiple(iterable $keys, mixed $default = null): iterable
Copy link
Contributor Author

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?


public function clear(): bool
{
$this->storage->clean([Nette\Caching\Cache::All => true]);
Copy link
Contributor Author

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"
Copy link
Contributor Author

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.

@h4kuna h4kuna changed the title add psr-16 implementation feat: add psr-16 implementation May 24, 2024
src/Bridges/Psr/Cache.php Outdated Show resolved Hide resolved
src/Bridges/Psr/Cache.php Outdated Show resolved Hide resolved
@h4kuna h4kuna force-pushed the add-implementation-psr-16 branch 2 times, most recently from 3bc4e14 to d31b325 Compare May 26, 2024 10:55
@h4kuna
Copy link
Contributor Author

h4kuna commented May 26, 2024

@JanTvrdik I squashed all commits, thank you.

@h4kuna h4kuna force-pushed the add-implementation-psr-16 branch from d31b325 to 15eaa3d Compare May 26, 2024 11:08
@h4kuna
Copy link
Contributor Author

h4kuna commented May 27, 2024

What is next step?

@h4kuna h4kuna requested a review from JanTvrdik May 28, 2024 06:42
@dg
Copy link
Member

dg commented Jun 3, 2024

Great, thank you

@dg dg merged commit 835fbe0 into nette:master Jun 3, 2024
@dg
Copy link
Member

dg commented Jun 3, 2024

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?

dg pushed a commit that referenced this pull request Jun 3, 2024
@h4kuna
Copy link
Contributor Author

h4kuna commented Jun 3, 2024

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.

dg pushed a commit that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants