title: ZF2 Doctrine2 Pagination Cache
body: <p>Does anybody of you know how to configure cache for zf2 pagination using doctrine2?</p>
  
  <p>The way i dot it:</p>
  
  <pre><code>$cache = \Zend\Cache\StorageFactory::factory ( 
                                                array (
                                                      'adapter' =&gt; array (
                                                           'name' =&gt; 'Filesystem',
                                                            'options' =&gt; array (
                                                                'ttl' =&gt; 10,
                                                                'cache_dir' =&gt;__DIR__.'/../../../data/cache/',
                                                                       ),
                                                                 'plugins' =&gt; array (
                                                                     'serializer' =&gt; array(
                                                                               'serializer' =&gt; 'igbinary'
                                                                           )
                                                                       )
                                                                   )
                                                             ) );
  
              return $cache;
  </code></pre>
  
  <p>But i get Exceptions like the following.</p>
  
  <p>\Zend\Cache\Storage\Adapter\Filesystem.php:1549</p>
  
  <p>Message:
  fwrite() expects parameter 2 to be string, object given</p>
  
  <p>\Zend\Cache\Storage\Adapter\Filesystem.php:1553</p>
  
  <p>Message:
  Error writing file '...\data\cache\zfcache-c0\zfcache-Zend_Paginator_2_722b98872575050f0443b2b626605650.dat'</p>
  
  <p>\Zend\Paginator\Paginator.php:637</p>
  
  <p>Message:
  Error producing an iterator</p>