Skip to content

feat: add psr-16 implementation - #77

Merged
dg merged 2 commits into
nette:masterfrom
h4kuna:add-implementation-psr-16
Jun 3, 2024
Merged

feat: add psr-16 implementation#77
dg merged 2 commits into
nette:masterfrom
h4kuna:add-implementation-psr-16

Conversation

@h4kuna

@h4kuna h4kuna commented May 24, 2024

Copy link
Copy Markdown
Contributor

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

@h4kuna h4kuna left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A few notes

Comment thread src/Bridges/Psr/Cache.php
/**
* @return Generator<string, mixed>
*/
public function getMultiple(iterable $keys, mixed $default = null): iterable

Copy link
Copy Markdown
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?

Comment thread src/Bridges/Psr/Cache.php

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

Copy link
Copy Markdown
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.

Comment thread composer.json
"tracy/tracy": "^2.9",
"phpstan/phpstan": "^1.0"
"phpstan/phpstan": "^1.0",
"psr/simple-cache": "^2.0 || ^3.0"

Copy link
Copy Markdown
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
Comment thread src/Bridges/Psr/Cache.php Outdated
Comment thread src/Bridges/Psr/Cache.php Outdated
Comment thread src/Bridges/Psr/Cache.php Outdated
@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

h4kuna commented May 26, 2024

Copy link
Copy Markdown
Contributor Author

@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

h4kuna commented May 27, 2024

Copy link
Copy Markdown
Contributor Author

What is next step?

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

dg commented Jun 3, 2024

Copy link
Copy Markdown
Member

Great, thank you

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

dg commented Jun 3, 2024

Copy link
Copy Markdown
Member

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

h4kuna commented Jun 3, 2024

Copy link
Copy Markdown
Contributor Author

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