Git Product home page Git Product logo

cache-file's People

Contributors

alexkart avatar chi-teck avatar dehbka avatar dependabot-preview[bot] avatar dependabot[bot] avatar devanych avatar luizcmarin avatar particleflux avatar samdark avatar sankaest avatar sartor avatar skugarev avatar stylecibot avatar terabytesoftw avatar viktorprogger avatar vjik avatar xepozz avatar

Stargazers

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

Watchers

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

cache-file's Issues

Question about touch time

I have saw this line: https://github.com/yiisoft/cache-file/blob/master/src/FileCache.php#L163 Would you think this is safe way to store TTL? What about store one as first line in the file and use next lines as cached value like this:

use SplFileObject;
use function serialize;
use function time;
use const LOCK_EX;
use const LOCK_UN;
use const PHP_EOL;

$file = new SplFileObject('/path/to/cache/file.bin', 'c+')

$file->flock(LOCK_EX);

$file->rewind();
$file->ftruncate(0);
$file->fwrite((string)(time() + 3600)); // TTL 1 hour
$file->fwrite(PHP_EOL);
$file->fwrite((string)serialize($value)); // cached value
$file->fflush();

$file->flock(LOCK_UN);

It's just a question because I had tried to find out whether can I use future time for time of creating of the file and didn't find any strong answer. But I think that time of creating should be time of creating and no more.

withDirectoryMode do nothing, ignored

What steps will reproduce the problem?

->withDirectoryMode(0777)
->withDirectoryLevel(0);

What is the expected result?

directory created with 0777

What do you get instead?

directory created with default 0775

Additional info

Q A
Version 2.0.0
PHP version 8.1
Operating system Linux Mint 20.3

Because of createDirectoryIfNotExists() in FileCache constructor building object with other than default directory mode will be ignored

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.