-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Compatibility with PSR-16/PSR-6 #7
Comments
Filesystem Storage does not fully support PSR-16. Lines 51 to 54 in aa56c2e
The problem is, that you cannot specify dynamic TTL per cache key and thus, you have exactly one possible TTL which is not useful when you are using the So I would not recommend using Filesystem in combination with Feel free to provide a PR with proper implementation. I am happy to merge this for the next major as it would be a BC break anyways. I've implemented this in some of my projects like this:
But this will require pretty much I/O so today, I would probably change the internal cache file format to pass the So, regarding this, I would change the Issue type from |
Hi team, I encountered the same issue with using PhpSpreadsheet. The key 'phpspreadsheet.65e162e5970b33.58521221.A1' doesn't match against pattern '/^[a-z0-9_+-]*$/Di' Using Laminas filesystem cache adapter with the SimpleCacheDecorator Kind regards |
That is due to the default key pattern. You can change that and allow But we can adapt key pattern in the future to allow dots. I do not see a big deal with that. Would you mind creating an RFC in a new issue? I do not have a need for this and thus having first hand infos such as your library ur using, etc. would provide a good base to discuss widening the key pattern. Thanks in advance. |
Feature Request
Summary
PSR-16 allows "A-Z, a-z, 0-9, , and ." as valid key characters for the cache item name. But the key name pattern of the Filesystem storage is "/^[a-z0-9+-]*$/Di" and therefore doesn't match PSR-16 since "." isn't allowed here. This leads to errors when using the simple cache decorator on libraries such as "browscap/browscap-php" that has a cache item named "browscap.version".
Current behavior
Using the simple cache decorator with a laminas cache storage such as Filesystem throws an Exception when a dot is used inside the cache item name.
Expected behavior
The cache storage should accept key names with a dot since it's specified by PSR-16 and breaks standard compatibility with the simple cache decorator. A valid key pattern for the Filesystem storage could be this one "^[a-z0-9_+-.]*$/Di".
The text was updated successfully, but these errors were encountered: