Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 1.14 KB

caching.rst

File metadata and controls

27 lines (20 loc) · 1.14 KB

Caching

DoctrineModule provides bridging between LaminasCache and DoctrineCommonCache. This may be useful in case you want to share configured cache instances across doctrine, symfony and laminas projects.

You may use Laminas\Cache within your doctrine-related projects as following:

$laminasCache = new \Laminas\Cache\Storage\Adapter\Memory(); // any storage adapter is OK here
$doctrineCache = new \DoctrineModule\Cache\LaminasStorageCache($laminasCache);
// now use $doctrineCache as a normal Doctrine\Common\Cache\Cache instance

You may use Doctrine\Common\Cache within your Laminas projects as following:

$doctrineCache = new \Doctrine\Common\Cache\ArrayCache(); // any doctrine cache is OK here
$adapterOptions = new \Laminas\Cache\Storage\Adapter\AdapterOptions();
$laminasCacheStorage = new \DoctrineModule\Cache\DoctrineCacheStorage($adapterOptions, $doctrineCache);
// now use $laminasCacheStorage as a normal Laminas\Cache\Storage\StorageInterface instance.