-
-
Notifications
You must be signed in to change notification settings - Fork 3
PHP Cache Engine v6.0 #17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
Include #[Override] attributes in methods for better code clarity and compliance, and update PHPUnit configurations and tests for PHP 8.4 support. Enhance documentation, streamline compatibility with newer versions of dependencies, and improve general code maintainability."
Add a `.gitpod.yml` setup for development environments and a VS Code debug configuration for PHP projects. Migrated PHPUnit annotations for data providers to PHP 8 attributes for improved code clarity and compliance with modern PHP versions.
Renamed `BaseCacheTest` to `TestBase` and updated corresponding test classes to align with the new naming convention. This improves readability and ensures consistent naming across the test suite.
Renamed test base classes for better clarity and cohesion, consolidating them under `MainTest`. Simplified imports by using concise class references, improving readability and maintainability. These changes enhance test structure organization and prepare the codebase for potential future extensions.
Renamed `MainTest` to `TestBase` and made it abstract to better reflect its role as a base class. Updated derived test classes (`CachePSR16MainTest` and `CachePSR6MainTest`) to extend `TestBase` and renamed them for consistency.
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.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Undocumented default expiration ▹ view |
Files scanned
File Path | Reviewed |
---|---|
src/Factory.php | ✅ |
src/Psr6/CacheItem.php | ✅ |
src/Psr16/SessionCacheEngine.php | ✅ |
src/Psr16/NoCacheEngine.php | ✅ |
src/Psr16/BaseCacheEngine.php | ✅ |
src/Psr16/ArrayCacheEngine.php | ✅ |
src/Psr6/CachePool.php | ✅ |
src/Psr16/ShmopCacheEngine.php | ✅ |
src/Psr16/RedisCacheEngine.php | ✅ |
src/Psr16/MemcachedEngine.php | ✅ |
src/Psr16/FileSystemCacheEngine.php | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Current Korbit Configuration
General Settings
Setting Value Review Schedule Automatic excluding drafts Max Issue Count 10 Automatic PR Descriptions ✅ Issue Categories
Category Enabled Documentation ✅ Logging ✅ Error Handling ✅ Readability ✅ Design ✅ Performance ✅ Security ✅ Functionality ✅ Feedback and Support
Note
Korbit Pro is free for open source projects 🎉
Looking to add Korbit to your team? Get started with a free 2 week trial here
public function expiresAfter(int|\DateInterval|null $time): static | ||
{ | ||
$this->expiration = new DateTime('now +1 year'); |
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.
Undocumented default expiration 
Tell me more
What is the issue?
The default expiration of 1 year when null is passed is not documented, which is a significant behavior that affects cache item lifetime.
Why this matters
Missing documentation about default behaviors can lead to unexpected outcomes when using the cache system.
Suggested change ∙ Feature Preview
/**
- Sets the expiration time for this cache item.
- {@inheritdoc}
- @param int|\DateInterval|null $time The expiration time
- @return static
- @note When null is passed, defaults to 1 year expiration
*/
Provide feedback to improve future suggestions
💬 Looking for more details? Reply to this comment to chat with Korbit.
This pull request updates PHP Cache Engine with several significant improvements and some breaking changes. The library continues to provide PSR-6 and PSR-16 cache implementations with multiple storage drivers, now with enhanced PHP 8.1-8.4 compatibility and modernized code.
Major Changes
#[Override]
attribute to methods implementing interfacescreateRedisCacheEngine()
method tocreateRedisPool()
for naming consistencyaddToNow()
methodBreaking Changes
Factory
createRedisCacheEngine()
renamed tocreateRedisPool()
BaseCacheEngine
withKeysFromContainer()
changed tostatic
addToNow()
Other Improvements
Compatibility
Upgrade Instructions
To upgrade from a previous version:
createRedisCacheEngine()
to usecreateRedisPool()
insteadcomposer require "byjg/cache-engine:^6.0"
Description by Korbit AI
What change is being made?
Enhance the PHP Cache Engine to version 6.0 by adding support for PHP 8.4, introducing new dependencies, updating test configurations, refining documentation, and improving code consistency with PHP 8.1+ features.
Why are these changes being made?
These changes address the need for compatibility with the latest PHP versions and enhance testing robustness by using environment variables for cache service configurations. The introduction of new testing features and refactored code aims to improve maintainability while ensuring adherence to PSR standards and supporting future updates with enhanced logging and container support features.