Stash\Interfaces\ItemInterface::lock PHP Method

lock() public method

Enables stampede protection by marking this specific instance of the Item as the one regenerating the cache.
public lock ( null $ttl = null ) : boolean
$ttl null
return boolean
    public function lock($ttl = null);

Usage Example

Example #1
0
 private function assertDisabledStash(\Stash\Interfaces\ItemInterface $item)
 {
     $this->assertFalse($item->set('true'), 'storeData returns false for disabled cache');
     $this->assertNull($item->get(), 'getData returns null for disabled cache');
     $this->assertFalse($item->clear(), 'clear returns false for disabled cache');
     $this->assertTrue($item->isMiss(), 'isMiss returns true for disabled cache');
     $this->assertFalse($item->extend(), 'extend returns false for disabled cache');
     $this->assertTrue($item->lock(100), 'lock returns true for disabled cache');
 }