voku / simple-cache Goto Github PK
View Code? Open in Web Editor NEW:zap: Simple Cache Abstraction Layer for PHP
License: MIT License
:zap: Simple Cache Abstraction Layer for PHP
License: MIT License
in src/voku/cache/AdapterApc.php, line 122
Method names should be declared in
camelCase
. You should rename this class to comply with PSR-1.
*
* @param $key
*
* @return bool
*/
public function apc_cache_exists($key)
{
return (bool)apc_fetch($key);
}
/**
Posted from SensioLabsInsight
For granular cache invalidation it's useful to have a middle road option between removeAll()
and removeItem(key)
, and that's removeThose(regexp
). So that I can remove all the items with a prefix, like 'imagecache_%'.
It would help avoid having to create multiple caches. But I understand that given the various backends the feature might be cumbersome to implement.
In the process of updating several repos, will link pull request to this issue.
in src/voku/cache/Cache.php, line 227
Method names should be declared in
camelCase
. You should rename this class to comply with PSR-1.
* use if your $_SERVER is behind a
* proxy that sets these values
*
* @return string
*/
private function get_client_ip($trust_proxy_headers = false)
{
if ($trust_proxy_headers) {
return $_SERVER['REMOTE_ADDR'];
}
Posted from SensioLabsInsight
in src/voku/cache/AdapterMemcached.php, line 69
Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.
* @return mixed|void
*/
public function set($key, $value)
{
// Make sure we are under the proper limit
/*
if (strlen($this->memcached->getOption(\Memcached::OPT_PREFIX_KEY) . $key) > 250) {
throw new \Exception('The passed cache key is over 250 bytes');
}
*/
Posted from SensioLabsInsight
Hi Lars
Plesk changed its defaults to use
Plesk 17.8.11 - PHP value "disable_functions" changed to default value "opcache_get_status"
And Hosters tend do follow this approach.
โ
/src/voku/cache/AdapterOpCache.php in Line 36 uses !empty(@\opcache_get_cache())
to check that op cache is enabled.
PHP 7.4 is @silenced, but PHP 8 errors in Userland. This disabled method could be replaced by
!empty(@\opcache_get_configuration())
I assume we better have something like
$opcache_get_configuration['directives']['opcache.enable'] === true
to ensure opcache is really enabled.
What do you think?
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
composer.json
php >=7.0.0
psr/simple-cache ~1.0 || ~2.0
phpunit/phpunit ~6.0 || ~7.0 || ~9.0
For security reasons it's common to restrict the opcache API in shared webhosting environments.
This is usually no problem, because applications have little reason to call into the opcache api directly. But in your library (which recently got added as a dependency to the serendipity blog software) this is the case, and it will cause warnings like:
Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in [path]/bundled-libs/voku/simple-cache/src/voku/cache/AdapterOpCache.php:32
See here for a similar issue in wp super cache:
https://github.com/Automattic/wp-super-cache/issues/536
One workaround would be to prefix the \opcache_get_status() with @ to avoid the warning, i.e. change the code to:
self::$hasCompileFileFunction = \function_exists('opcache_compile_file') && !empty(@Bilge @\opcache_get_status());
This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Posted from SensioLabsInsight
Are feature requests okay here?
If I see that correctly the OpCache Constructor supports setting a cache dir, but the class above (Cache) seems to have no way to actually to set that variable when calling that constructor. Is there a way to configure it?
On some shared hosters you do not actually want to write to the configured PHP tmp directory, but rather to a project specific tmp directory.
This is fixed in master but it isn't pushed as a release so it has broken simple-mysqli suddenly.
"autoload": {
"psr-0": {
"voku": "src"
}
}
Needs to be:
"autoload": {
"psr-0": {
"voku\\cache\\": "src"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.