-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Invalidating Inconsistencies #18
Comments
We just ran across this issue at work. I will have an attempt at rewriting some documentation soon. Any help would be appreciated. Feedback / thoughts @tedivm @XedinUnknown . Thanks. |
The issue we ran across was how to actually change invalidation methods. The documentation is completely wrong in this regard. <?php
$item = $pool->getItem('Test');
// Get the data from the cache using the "Invalidation::OLD" technique for
// dealing with stampedes
$userInfo = $item->get();
$userInfo->setInvalidationMethod(Stash\Invalidation::OLD);
// Check to see if the cache missed, which could mean that it either didn't
// exist or was stale. If another process is regenerating this value and
// there is a stored value available then this function will return a hit.
if(!$item->isHit())
{
// Mark this instance as the one regenerating the cache. Because our
// protection method is Invalidation::OLD other Stash instances will
// use the old value and count it as a hit.
$item->lock();
// Run the relatively expensive code.
$userInfo = loadUserInfoFromDatabase($id);
// Store the expensive code so the next time it doesn't miss. The store
// function marks the stampede as over for now, so other Stash items
// will begin working as normal.
$pool->save($item->set($userInfo));
}
I think this is supposed to be |
In a few places on the page about invalidation, it says that the invalidation method is set by passing additional values to "Item->get", such as:
There's also a mistake there, calling a method a class. In other instances, the method doesn't have parentheses at the end, such as here:
In the examples no additional values are passed to that method. Instead, a method not mentioned before is invoked, such as:
I still cannot understand how to control invalidation because of this. Also, you may want to replace things like "Item->get" with
ItemInterface#get()
, e.g. including proper inline code and displaying it as such.The text was updated successfully, but these errors were encountered: