jeremykendall / php-domain-parser

Public Suffix List based domain parsing implemented in PHP
MIT License
1.16k stars 128 forks source link

Cache get always unlinks cache file #258

Closed thomassb closed 4 years ago

thomassb commented 4 years ago

Issue summary

On getting a cache item time() >= $expires_at always is true.

System informations

Information Description
Pdp version 5.6.0
PHP version 7.2.15
OS Platform Linux version 4.19.76-linuxkit (root@d203b39a3d78) (gcc version 8.3.0 (Alpine 8.3.0)) #1 SMP Thu Oct 17 19:31:58 UTC 2019

Standalone code, or other way to reproduce the problem

 $this->cache->set('foo','bar');
//Cache file is created
 $this->cache->get('foo');
//Cache file is deleted

Expected result

'bar'

Actual result

null

nyamsprod commented 4 years ago

@thomassb thank for using the library

two remarks:

Bottom line, you can try to fix this or else I will do it when I have time but I would encourage you to not use this cache adapter outside of the current usage for which it was build for.

nyamsprod commented 4 years ago

@thomassb I've tried to reproduce your reported bug on a linux based PHP7.4.1 but I can't reproduce it. Are you using the cache with something else that the bundle Manager class ? If so I would first review your code to be sure it's not your code at fault and I would use a more robust cache system .. as I failed to reproduce your error.

thomassb commented 4 years ago

Sorry @nyamsprod seems like it's my environment. I looked through the cache code and could not find a problem I then tried to repoduce it myself on a different machine and could not. Seems like my development environment on a windows machine was not allowing modification of the cache file modified date.

leem32 commented 4 years ago

This is the problem I'm having in #259 Running CentOS 7 on Vagrant with a Windows 7 Host. Once a day the cache file is deleted so I have to manually run composer from windows to update the cache files again. I tried increasing the cache duration to 14 days with $manager = new Manager(new Cache(), new CurlHttpClient(), '14 DAY');, but it made no difference. It's not a problem on remote, but still quite frustrating.