Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save() than isMiss() -> true #316

Open
IAkumaI opened this issue Aug 30, 2016 · 4 comments
Open

save() than isMiss() -> true #316

IAkumaI opened this issue Aug 30, 2016 · 4 comments

Comments

@IAkumaI
Copy link

IAkumaI commented Aug 30, 2016

$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().

@Unrealomega
Copy link

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.

@Unrealomega
Copy link

Unrealomega commented Oct 15, 2016

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.

@Unrealomega
Copy link

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.

@alexbowers
Copy link
Contributor

Is this still a bug in the system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants