yii2 icon indicating copy to clipboard operation
yii2 copied to clipboard

yii\base\Module createControllerByID add cache

Open easydowork opened this issue 1 year ago • 2 comments

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues #20114

easydowork avatar Feb 11 '24 17:02 easydowork

PR Summary

  • Enhanced Caching Mechanism in Module.php The update in this file involves the addition of a caching feature to the createControllerByID method. The method initially checks whether there's a cache present for a given ID. If the cache doesn't exist, it continues with the standard procedure. On the other hand, if the cache is present, it retrieves the associated class name. It then verifies whether the class name exists and certifies that it is a subclass of yii\base\Controller. This enhancement is designed to improve the retrieval speed of information, making our services more efficient.

what-the-diff[bot] avatar Feb 11 '24 17:02 what-the-diff[bot]

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (0027227) 48.02% compared to head (29567a9) 48.02%.

Files Patch % Lines
framework/base/Module.php 82.60% 4 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #20115   +/-   ##
=======================================
  Coverage   48.02%   48.02%           
=======================================
  Files         445      445           
  Lines       43892    43900    +8     
=======================================
+ Hits        21080    21084    +4     
- Misses      22812    22816    +4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 11 '24 17:02 codecov[bot]

I sure hope no one is seriously thinking adding this PR into codebase, this is type of stuff that may kill the framework

Webkadabra avatar Feb 25 '24 00:02 Webkadabra

I will do a simple test, using the microtime (true) function to calculate the difference, and replacing preg_replace_callback with cache in the createControllerByID function does indeed improve the calculation time, but it increases the complexity and instability risk of the system. So I gave up.

easydowork avatar Feb 25 '24 12:02 easydowork