phpfastcache icon indicating copy to clipboard operation
phpfastcache copied to clipboard

Psr16 adapter and useStaticItemCaching

Open remcohn opened this issue 2 years ago • 1 comments

What type of issue is this?

Incorrect/unexpected/unexplainable behavior

Operating system + version

Debian 12

PHP version

8.3

Connector/Database version (if applicable)

Redis

Phpfastcache version

9.2.0 ✅

Describe the issue you're facing

If you use the Psr16 adaptor and get() and item in a loop, and it expires, the value is never refreshed.

Expected behavior

As indicated in the help for useStaticItemCaching : Can be used for cron script that loop indefinitely on cache items to avoid calling detachAllItems()/detachItem($item) from the cache pool.

But detach is not available in the Psr16 adapator. shouldnt then get() try to refresh the item?

Code sample (optional)

No response

Suggestion to fix the issue (optional)

No response

References (optional)

No response

Do you have anything more you want to share? (optional)

No response

Have you searched in our Wiki before posting ?

  • [X] I have searched over the Wiki

remcohn avatar Nov 14 '24 08:11 remcohn

You can indeed passe the "useStaticItemCaching=false" option to the second argument of Psr16Adapter constructor, so you won't need to call detach* methods :)

Geolim4 avatar Nov 27 '24 16:11 Geolim4