Neos\Cache\Backend\ApcBackend::get PHP Method

get() public method

Loads data from the cache.
public get ( string $entryIdentifier ) : mixed
$entryIdentifier string An identifier which describes the cache entry to load
return mixed The cache entry's content as a string or FALSE if the cache entry could not be loaded
    public function get($entryIdentifier)
    {
        $success = false;
        $value = apc_fetch($this->identifierPrefix . 'entry_' . $entryIdentifier, $success);
        return $success ? $value : $success;
    }

Usage Example

 /**
  * @test
  */
 public function flushRemovesOnlyOwnEntries()
 {
     $thisCache = $this->createMock(FrontendInterface::class);
     $thisCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thisCache'));
     $thisBackend = new ApcBackend($this->getEnvironmentConfiguration(), []);
     $thisBackend->setCache($thisCache);
     $thatCache = $this->createMock(FrontendInterface::class);
     $thatCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('thatCache'));
     $thatBackend = new ApcBackend($this->getEnvironmentConfiguration(), []);
     $thatBackend->setCache($thatCache);
     $thisBackend->set('thisEntry', 'Hello');
     $thatBackend->set('thatEntry', 'World!');
     $thatBackend->flush();
     $this->assertEquals('Hello', $thisBackend->get('thisEntry'));
     $this->assertFalse($thatBackend->has('thatEntry'));
 }