PHPSocialNetwork / phpfastcache

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
https://www.phpfastcache.com
MIT License
2.36k stars 452 forks source link

Tags are deleted automatically #859

Closed adis0308 closed 2 years ago

adis0308 commented 2 years ago

Configuration

Describe the bug Tags that have an expiration date are always deleted even though one of the items still exists.

Expected behavior I want the Tag to not be deleted if the Item in the tag still exists.

Code Example $cache = $InstanceCache->getItem('item'); $cache->set('cache data here')->expiresAfter(60); $cache->addTags(['global', 'tag1']);

$cache = $InstanceCache->getItem('another item'); $cache->set('another cache data here')->expiresAfter(1314000); $cache->addTags(['global', 'tag 2']);

In the example code above it produces If the "item" cache expires then the "global" and "tag 1" tags will be deleted. The "global" tag should not be deleted because it still has cache "another item" with tag "tag 2"

github-actions[bot] commented 2 years ago

Hello curious contributor ! Since it seems to be your first contribution, make sure that you've been:

Geolim4 commented 2 years ago

Hello,

Hmm weird, I will made some tests tonight, I'm surprised this case is not covered by tests.

Cheers, Georges

Geolim4 commented 2 years ago

Hello,

I made some tests (on Files driver) and I'm unable to reproduce the bug: image

Geolim4 commented 2 years ago

Also I'm able to recover the second cache item by its tag after the first one being deleted: image

Geolim4 commented 2 years ago

Also you are no longer up to date:

On v8 the 8.1.2 is the latest version. On v9 the 9.1.0 is the latest version.

So you may want to update before trying again.

adis0308 commented 2 years ago

Please reopen this issue. I have tried version 8.1.2 and it doesn't solve the problem. I am using Redis cache and the problem is not solved. If I add more alternative tags then the 'global' tag like in the example will be deleted automatically again.

Geolim4 commented 2 years ago

I can't reproduce it, I made deep tests, the CI passe too with multiple tags tests, I can't reproduce it πŸ€·πŸ»β€β™‚οΈ

Geolim4 commented 2 years ago

Redis tests with tags on v8 3 days ago: https://app.travis-ci.com/github/PHPSocialNetwork/phpfastcache/jobs/565989218#L5485

Geolim4 commented 2 years ago

Due to the fact that I'm unable to reproduce this bug, confirmed by deep tests, I'm reclosing it again, until you provide me a strong proof with code and screenshoot/video if needed.

Thanks.