1. Go to this page and download the library: Download juneym/zf2-cache-mongo 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/ */
juneym / zf2-cache-mongo example snippets
public function testCanAttachCacheItemAttributes()
{
$mongoCache = new Storage\Adapter\Mongo($this->options);
$cacheKey = md5('this is a test key with attributes' . __METHOD__);
$itemAttribute = array(
'current_page' => 'http://hello-world.com/about-us.html',
'browser' => 'Firefox'
);
$mongoCache->setCacheItemAttributes($itemAttribute);
$result = $mongoCache->setItem($cacheKey, array('x' => 11111, 'y' => 'ABCDEF' . rand(0,10000)));
$this->assertTrue($result);
$data = $mongoCache->getItem($cacheKey);
$this->assertArrayHasKey('attr', $data);
$this->assertEquals($itemAttribute['current_page'], $data['attr']['current_page']);
$this->assertEquals($itemAttribute['browser'], $data['attr']['browser']);
$itemAttribute1 = $mongoCache->getCacheItemAttributes();
$this->assertTrue(is_array($itemAttribute1));
$this->assertTrue(empty($itemAttribute1));
unset($mongoCache);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.