Invalidation method passed to `CacheItem::get` is not having any effect
fred-jan opened this issue · 0 comments
The $invalidation
argument of the Tedivm\StashBundle\Service\CacheItem:get
method is not having any effect since version 0.6.1. This version of the bundle started using the 0.14.x version of Stash, which discarded these parameters in the get
-function.
As a side-effect the items using the bundle will now always default to the precompute invalidation method instead of the regular invalidation method.
What would be the best way to fix this issue? Currently the invalidation method is passed along to the
parent Item
class like this:
public function get($invalidation = 0, $arg = null, $arg2 = null)
{
// ...
$result = parent::get($invalidation, $arg, $arg2);
// ...
}
I assume it would not be ok to change the invalidation method on the item here, since this might go unnoticed and cause issues?:
public function get($invalidation = 0, $arg = null, $arg2 = null)
{
// ...
$this->setInvalidationMethod($invalidation, $arg, $arg2);
$result = parent::get();
// ...
}
Perhaps it would be better to remove these invalidation arguments from this class?