Stash\Item::set PHP Method

set() public method

public set ( $value )
    public function set($value)
    {
        if (!isset($this->key)) {
            return false;
        }
        if ($this->isDisabled()) {
            return $this;
        }
        $this->data = $value;
        return $this;
    }

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::set