Comments (13)
Hello,
That's an expected behavior to be honest, not a bug.
The item object is statically still present in the Phpfastcache internal storage.
So you're basically just trying to write an expired item to Redis which return false, as expected.
You have two options:
- Use the "Detach API" and reconfigure your cache item:
- Disable
useStaticItemCaching
, see options in Wiki
So, It's not a bug, it's a feature :D
from phpfastcache.
Thank you very much for your attention and fast answer.
Ok, I'll study the options and decide what to do, but for me maybe the best option is to set ttl everytime I save an item, because relying on defaultTtl is not giving the behaviour I expected
from phpfastcache.
The default ttl only work for new cache items, that does not exist in the internal storage.
If an object with the specified key exists in the cache storage or in the backend, the default values are not applied.
from phpfastcache.
The default ttl only work for new cache items, that does not exist in the internal storage. If an object with the specified key exists in the cache storage or in the backend, the default values are not applied.
Thank you again for your help, yes, I understand, that's why I'm thinking of not using defaulTtl anymore and substitute it with an explicit expiresAfter() that works in new and already existing items
from phpfastcache.
The static storage is intended to avoid querying the original backend if the item has been already fetched using getItem* methods. If you disable useStaticItemCaching
, the core will ignore static storage and will always query the original backend. Therefore if the item has expired and the backend returns nothing, you will get a new * not hit * fresh item with default TTL applied (900s)
from phpfastcache.
The static storage is intended to avoid querying the original backend if the item has been already fetched using getItem* methods. If you disable
useStaticItemCaching
, the core will ignore static storage and will always query the original backend. Therefore if the item has expired and the backend returns nothing, you will get a new * not hit * fresh item with default TTL applied (900s)
I understand that disabling static storage is easy and no code changes are required, but sure the performance will be affected, so having the chance to tweak my set($key, $value, $ttl) method and call expiresAfter() always (with default or explicit ttl) maybe is the solution with minimum code changes and not sacrifice performance... Don't you think so?
from phpfastcache.
Disabling static storage may slightly reduce performances for applications that critically need fresh cache item.
In your case, I think you should, indeed, always specify the desired expiration time to be POLA-compliant :P
from phpfastcache.
POLA-compliant
Sorry, I don't catch it ...
from phpfastcache.
POLA-compliant
Sorry, I don't catch it ...
Principe Of Last Astonishment, look on Wikipedia.
Basically it means, always be as much explicit as you can, in order to avoid any undesired behavior from your code :)
from phpfastcache.
Ok! Interesting, thank you very much! I understand
Last but not least, I want to thank you for your software, phpfastcache rocks! It made our migration from apcu and memcached to redis very easy, and the tags feature is very very useful!
from phpfastcache.
Ok! Interesting, thank you very much! I understand Last but not least, I want to thank you for your software, phpfastcache rocks! It made our migration from apcu and memcached to redis very easy, and the tags feature is very very useful!
Thank you :)
Everything's good for you now ?
from phpfastcache.
Ok! Interesting, thank you very much! I understand Last but not least, I want to thank you for your software, phpfastcache rocks! It made our migration from apcu and memcached to redis very easy, and the tags feature is very very useful!
Thank you :) Everything's good for you now ?
Aye! Everything is ok for me now!
from phpfastcache.
Great :D
from phpfastcache.
Related Issues (20)
- Cloudflare - Cache Reserve R2 | Object Storage Driver HOT 7
- Website broken - Unable to browse any documentation page HOT 6
- PDO Cache is case insensitive? HOT 4
- Proper way to preload cache items with crontab HOT 14
- Memcached driver compress_data cache miss HOT 4
- Config('path') - Can't declare path from the parent directory of index file directory. HOT 6
- Installation fails: 'Fatal error: Uncaught Error: Class "CacheManager" not found ...' HOT 3
- getItemsByTag() - empty after one item has expired HOT 10
- Can´t retrieve phpfastcache 9.1.3 thru composer HOT 7
- 2 million data cache? HOT 5
- Storing and retrieving mysql result arrays using Psr16Adapter HOT 4
- Deleting cache by tag without loading all its cache HOT 3
- cache not clearing manually in html HOT 2
- Disable 'securityKey' and adapter directory. HOT 9
- Cache clear() not working with Redis, getItem() still returns data HOT 2
- How to use memcache on v8 ? HOT 3
- Support custom native RedisCluster client HOT 9
- TypeError Phpfastcache\Drivers\Files\Driver::driverRead(): Return value must be of type ?array, bool returned HOT 13
- Memory size exhausted by deleting by Tags HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpfastcache.