-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Labels
Description
Description
Hello. The issue that I use RedisTagAwareAdapter for production, but need to test it in memory with ArrayAdapter or NullAdapter, which doesn't implements TagAwareAdapterInterface.
So for tests in production code I should check if adapter implements TagAwareAdapterInterface and, for example, add tags to cache item:
// production code below
// adapter can be RedisTagAwareAdapter or ArrayAdapter or NullAdapter
if ($this->adapter instanceof TagAwareAdapterInterface) {
$item->tag([self::TAG]);
}
Without checking I will get an error 'Cache item "%s" comes from a non tag-aware pool: you cannot tag it.'
.
Finally code is not totally covered
I think will be great to create new class ArrayTagAwareAdapter and add interface TagAwareAdapterInterface to NullAdapter out-of-box to easier test Cache layer.
What do you think?
p.s. before doing a PR I started this short discussion
Example
No response