PHP code example of cache / doctrine-adapter-bundle

1. Go to this page and download the library: Download cache/doctrine-adapter-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cache / doctrine-adapter-bundle example snippets


$bundles(
    // ...
    new Cache\Adapter\DoctrineAdapterBundle\DoctrineAdapterBundle(),
    // ...
);
 php
/** @var CacheItemPoolInterface $cache */
$cache = $this->container->get('cache.provider.acme_apc_cache');
// Or
$cache = $this->container->get('cache'); // This is either the `default` provider, or the first provider in the config

/** @var CacheItemInterface $item */
$item = $cache->getItem('cache-key');
$item->set('foobar');
$item->expiresAfter(3600);
$cache->save($item);