set() public method

Saves data in the cache.
public set ( string $entryIdentifier, string $data, array $tags = [], integer $lifetime = null ) : void
$entryIdentifier string An identifier for this specific cache entry
$data string The data to be stored
$tags array Tags to associate with this cache entry
$lifetime integer Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
return void
 /**
  * @test
  */
 public function flushRemovesOnlyOwnEntries()
 {
     $backendOptions = ['servers' => ['localhost:11211']];
     $thisCache = $this->getMockBuilder(AbstractFrontend::class)->disableOriginalConstructor()->getMock();
     $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
     $thisBackend = new MemcachedBackend($this->getEnvironmentConfiguration(), $backendOptions);
     $thisBackend->setCache($thisCache);
     $thatCache = $this->getMockBuilder(AbstractFrontend::class)->disableOriginalConstructor()->getMock();
     $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
     $thatBackend = new MemcachedBackend($this->getEnvironmentConfiguration(), $backendOptions);
     $thatBackend->setCache($thatCache);
     $thisBackend->set('thisEntry', 'Hello');
     $thatBackend->set('thatEntry', 'World!');
     $thatBackend->flush();
     $this->assertEquals('Hello', $thisBackend->get('thisEntry'));
     $this->assertFalse($thatBackend->has('thatEntry'));
 }