Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix not using the adapter's cache item#137

Merged
juampynr merged 2 commits into
masterfrom
fix-cacheitem
Jul 5, 2018
Merged

Fix not using the adapter's cache item#137
juampynr merged 2 commits into
masterfrom
fix-cacheitem

Conversation

@deviantintegral
Copy link
Copy Markdown
Member

@deviantintegral deviantintegral commented Jul 4, 2018

I discovered that the Drupal module wasn't caching any resolveDomain responses. It comes down to these lines in Symfony's cache library:

\Symfony\Component\Cache\Adapter\AbstractAdapter::save:

    public function save(CacheItemInterface $item)
    {
        if (!$item instanceof \Symfony\Component\Cache\CacheItem) {
            return false;
        }

At first, I thought this was an obvious bug - why force a specific concrete implementation? Git led me to this issue and comment thread:

symfony/symfony#17408 (diff)

In other words, what Symfony is doing is OK by the spec (though confusing PHP-wise). CacheItems should only be created by calling get() on the cache adapter, which ensures it's a compatible object.

@juampynr juampynr merged commit 97d3b01 into master Jul 5, 2018
@juampynr juampynr deleted the fix-cacheitem branch July 5, 2018 10:42
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

Successfully merging this pull request may close these issues.

2 participants