divineomega / do-file-cache Goto Github PK
View Code? Open in Web Editor NEW๐๏ธ PHP File-based Caching Library
License: GNU Lesser General Public License v3.0
๐๏ธ PHP File-based Caching Library
License: GNU Lesser General Public License v3.0
In the line, error suppression (@
) is used:
https://github.com/DivineOmega/DO-File-Cache/blob/master/src/DOFileCache.php#L136
Unfortunately, upon heave use of this code, your error log will get cluttered with error messages. Surely the @ prevents errors to be written to standard output (/web browser), but errors are still written to custom error handlers and log files.
Hence, I propose to not use error suppression, and solve the real problem at hand here. Data is only serialized whenever it is not a string:
https://github.com/DivineOmega/DO-File-Cache/blob/master/src/DOFileCache.php#L52 , so to clarify: ints, bools and floats are serialized as well. My suggestion is to always serialize, strings too, and also always unserialize. This way the get procedure will not result in loads of notices in the log any more.
The only downside is that strings will have to be serialized, increasing some storage space and computation time. This does not outweight the benefit of having well-defined storage characteristics, imho.
Btw, I'm posting this as a user of the divineomega/password_exposed library, which is an example of this issue in practice.
Hi,
I am on Windows and therefore the sys_getloadavg() function does not exist and even though I haven't touched the default configuration "'unixLoadUpperThreshold' => -1," as the suggestion in the exception message reads, the exception is nevertheless thrown. I think this check
DO-File-Cache/src/DOFileCache.php
Line 122 in 261c6e3
should be done instead before this line
DO-File-Cache/src/DOFileCache.php
Line 129 in 261c6e3
Best regards,
Dimitar
According to clearstatcache function reference, the file state cache is effected on following related file functions:
Affected functions include stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), and fileperms().
To avoid file stat caching, it should use this function before manipulating any file operation :).
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.