gregwar / cache Goto Github PK
View Code? Open in Web Editor NEWA lightweight filesystem caching system
License: MIT License
A lightweight filesystem caching system
License: MIT License
Deprecated: Required parameter $function follows optional parameter $conditions in vendor/gregwar/cache/Gregwar/Cache/Cache.php on line 324
When checking for a condition of 'younger-than' filectime is used, that causes the check to return false results on Windows system, as it checks for original file creation date which never changes. The fix would be to use filemtime that has a correct last file modification date of the original file.
Hi, I noticed the max-age $age variable is negative hence compares badly.
Cache.php:159
In file Cache.php, @Unlink($cacheFile) may sometimes generate an error.
It seems to be a good idea to replace it by :
if(file_exists($cacheFile)) {
unlink($cacheFile);
}
Thanks and greetings for this library!
When I run the max-age.php
script from demo directory, this is the output:
$ php max-age.php
First call: generating file...
Waiting 4s...
Third call: generating cache file, because it expired...
But when I run it once again:
$ php max-age.php
First call: generating file...
Second call: generating file, this should not happen!...
Waiting 4s...
Third call: generating cache file, because it expired...
My OS is Windows 7 x64 and
$ php -v
PHP 5.5.9 (cli) (built: Feb 5 2014 13:02:39)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Hi,
Thanks for sharing that lib.
I suggest adding a set
method.
write
isn't natural when getter is get
.
( set + get or write + read but not write+get )
PSR-06 gives a caching interface for interoperability. Whilst doing this will be a BC break for your code and major version bump, it will give greater flexibility for your dependent libraries, Formidable in particular. Most dev shops will already have caching sorted and not want to use yet another one. By implementing PSR-06, you can flexibility in allowing users to utilise a different caching system that uses a different storage mechanism.
Now, there is some controversy as to whether PSR-06 is fit for purpose (see here and follow the links.) So you may not want to. There is evidence that it is gaining ground though, (see here.) Instead, you may want to consider supplying a new interface definition and use that as the type hint, with your caching mechanism implementing it. It would have to be a bit more generic than your current one, as that is very bound to using files. Consider replacing setCacheDirectory($cacheDirectory) with setCacheOptions(array $options) for instance
Hi,
I've noticed Gregwar/Cache suffers form the same problem as described here Gregwar/ImageBundle#26. Which hinders my use of the Gregwar/ImageBundle, since it depends on one another.
It's in the file Gregwar/Cache/Cache.php on line 159 and 168. I'll make a pull request if I have the time.
Kind regards,
Lisje
At the moment the default directory size is 5 - this creates extremely deep structure that puts a huge strain on the disk when it comes to seeks and writes. Doing a du
in a large directory - good luck with that, command took over 3 hours. Cleaning up old files - again, good luck with that.
Could we have more options when it comes to defining the structure of the directories?
For instance, I would like to have only one level deep with alpha characters (a-z) 2 characters in length so:
cache/aa/<hash>.jpg
cache/ab/<hash>.jpg
cache/ac/<hash>.jpg
etc
This will allow for 676 directories one level-deep with say an average target of 3000-5000 files per folder giving an allowance of over 2 million images with minimal seeks / performance issues.
In combination with Gregwar/Image#81 it would be nice to have an interface that defines all the contracts so you can inject your own CacheInterface
.
Hi,
https://github.com/Gregwar/Cache/blob/master/Cache.php#L272
You just check for http/https. As of PHPs file-wrappers, you should change this to even fit with
ftp, ftps etc..
http://php.net/manual/en/wrappers.php
Actually I think you don't need to support everything, but at least ftp, ftps, sftp, ssh ?
Just a thought!
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.