Sokil\Mongo\Cache::set PHP Method

set() public method

Set with expiration in seconds
public set ( integer | string $key, mixed $value, integer $ttl, array $tags = null )
$key integer | string
$value mixed
$ttl integer
$tags array
    public function set($key, $value, $ttl, array $tags = null)
    {
        $this->setDueDate($key, $value, time() + $ttl, $tags);
        return $this;
    }

Usage Example

Example #1
0
 public function testDelete()
 {
     $this->cache->set('php', 'PHP: Hypertext Processor', 1);
     $this->assertEquals('PHP: Hypertext Processor', $this->cache->get('php'));
     $this->cache->delete('php');
     $this->assertEmpty($this->cache->get('php'));
 }