Stash
Stash copied to clipboard
Too many clears if lock()is used
I have a class with method which gets data from MySQL. In this method I use:
if ($cacheItem->isMiss()) {
$cacheItem->lock();
...
$cacheItem->save();
}
All looks well, but in fact when I call lock() also called clear() and storeData() methods.
I my app I have 1000+ objects. Every object use different cache keys.
So, when I try to get 1000+ objects at one time, I have a many-many (100000+) call of clear() method.
It very slows down app.
Im sorry if this text is too difficult to understand. If you need I can write this in Russian :)