Stash\Item::setPool PHP Method

setPool() public method

public setPool ( Stash\Interfaces\PoolInterface $pool )
$pool Stash\Interfaces\PoolInterface
    public function setPool(PoolInterface $pool)
    {
        $this->pool = $pool;
        $this->driver = $pool->getDriver();
    }

Usage Example

 public function testConstructionOptions()
 {
     $key = array('apple', 'sauce');
     $options = array();
     $options['servers'][] = array('127.0.0.1', '11211', '50');
     $options['servers'][] = array('127.0.0.1', '11211');
     $options['extension'] = $this->extension;
     $driver = new Memcache();
     $driver->setOptions($options);
     $item = new Item();
     $poolStub = new PoolGetDriverStub();
     $poolStub->setDriver($driver);
     $item->setPool($poolStub);
     $item->setKey($key);
     $this->assertTrue($item->set($key), 'Able to load and store memcache driver using multiple servers');
     $options = array();
     $options['extension'] = $this->extension;
     $driver = new Memcache();
     $driver->setOptions($options);
     $item = new Item();
     $poolStub = new PoolGetDriverStub();
     $poolStub->setDriver($driver);
     $item->setPool($poolStub);
     $item->setKey($key);
     $this->assertTrue($item->set($key), 'Able to load and store memcache driver using default server');
 }
All Usage Examples Of Stash\Item::setPool