GithubHelp home page GithubHelp logo

cache's People

Contributors

akrabat avatar alexzeitgeist avatar chrisbarr avatar garygreen avatar gregwar avatar mahagr avatar nubs avatar viktorasp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cache's Issues

PHP 8.0 compatibility issues

Deprecated: Required parameter $function follows optional parameter $conditions in vendor/gregwar/cache/Gregwar/Cache/Cache.php on line 324

'younger-than' check fails on windows system

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.

max-age not working

Hi, I noticed the max-age $age variable is negative hence compares badly.
Cache.php:159

cache file unlink silent execution error

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!

max-age not working on Windows if file already exists

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

set method

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 )

Consider implementing PSR-06

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

filectime throws warning

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

Performance with deep structure

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.

Add interface

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.