Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method Symfony\Component\Cache\Adapter\Psr16Adapter::set() #199

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Service/AccessManagement/ResolveBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Lullabot\Mpx\AuthenticatedClient;
use Lullabot\Mpx\Cache\Adapter\PHPArray\ArrayCachePool;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\AdapterInterface;

abstract class ResolveBase
{
Expand Down Expand Up @@ -43,6 +44,15 @@ protected function saveCache($key, $resolved)
// Since many of their examples and other mpx clients hardcode these
// values, we assume 30 days and that they will implement redirects or
// domain aliases if required.
$this->cache->set($key, $resolved, new \DateInterval('P30D'));
$expiration_time = new \DateInterval('P30D');
if ($this->cache instanceof AdapterInterface) {
$item = $this->cache->getItem($key);
$item->set($resolved);
$item->expiresAfter($expiration_time);
$this->cache->save($item);
} else {
$this->cache->set($key, $resolved, $expiration_time);
}
}
}