Skip to content
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);
}
}
}