Skip to content

Conversation

@alafon
Copy link
Contributor

@alafon alafon commented Jan 24, 2017

We might need to call getCacheKeyFromKey and checkKey when extending the Dataloader class, in order to have homogeneous keys.

Here is an exemple:

    public function load($key)
    {
        $cacheItem = $this->primeCache->getItem($this->getCacheKeyFromKey($key));

        if (!$cacheItem->isHit()) {
            $promise = parent::load($key);
            if ($promise instanceof Promise) {
                $promise->then(function ($value) use ($key) {
                    $this->prime($key, $value);
                });
            }
            return $promise;
        } else {
            return $cacheItem->get();
        }
    }

@mcg-web mcg-web merged commit 11c2f80 into overblog:master Jan 24, 2017
@alafon alafon deleted the key-functions-not-private branch January 24, 2017 16:38
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