Stash
Stash copied to clipboard
save() than isMiss() -> true
$key = md5(microtime(true));
$cache = $pool->getItem($key);
$cache->set('Test value');
$cache->save();
if ($cache->isMiss()) {
echo 'Missed', PHP_EOL;
}
echo 'Value: ', $cache->get(), PHP_EOL;
No matter what driver is used. It always will be Missed. Because of after save() isMiss method do not call excuteGet() because of $this->data of Item is filled.
The solution is get new Item before check isMiss().
Having a similar issue, item will not return true after saving and running "isHit()". Looking at the source, it does appear to be the aforementioned case. Will do a quick test and create a pull request.
So, what I can see on my end, apparently the miss is occurring due to Expiration not being set. This looks to be due to how Interval deals with seconds, as anything above 3599 seconds will be ignored when it's added/substracted, suspect this is due to how Interval deals with time. Looking at making a fix for that now.
Made an update to my fork, though now I'm seeing issues with it storing the expiration date of the item, which I'm not sure why (Switch from Redis to Ephemeral to no affect). For now, I give up on this and will just look at other options than Stash.
Is this still a bug in the system?