Gaufrette\Adapter\InMemory::write PHP Method

write() public method

public write ( $key, $content, array $metadata = null )
$metadata array
    public function write($key, $content, array $metadata = null)
    {
        $this->files[$key]['content'] = $content;
        $this->files[$key]['mtime'] = time();
        return Util\Size::fromContent($content);
    }

Usage Example

 /**
  * @test
  */
 public function shouldNotWriteToFallbackOnFillOnMiss()
 {
     $key = "test-file";
     $contents = "abc123";
     $this->readthroughAdapter = new ReadthroughAdapter($this->primary, $this->fallback, true);
     $this->fallback->write($key, $contents);
     $this->readthroughAdapter->read($key);
     $this->assertTrue($this->primary->exists($key), "primary should not have copy of read file");
     $this->assertEquals($contents, $this->primary->read($key), "primary file should match fallback file");
 }
All Usage Examples Of Gaufrette\Adapter\InMemory::write