Ejemplo n.º 1
0
 public function testClearExpiredLock()
 {
     $this->assertNotEmpty($this->gateway->select(['key' => 'past']));
     $this->assertNotEmpty($this->gateway->select(['key' => 'past2']));
     $this->throttleDbAdapter->clearExpiredLock('past');
     $this->assertEmpty($this->gateway->select(['key' => 'past']));
     $this->assertNotEmpty($this->gateway->select(['key' => 'past2']));
     $this->throttleDbAdapter->clearExpiredLock();
     $this->assertEmpty($this->gateway->select(['key' => 'past2']));
     $this->assertNotEmpty($this->gateway->select(['key' => 'forever']));
 }
Ejemplo n.º 2
0
 /**
  * @param string $key
  */
 public function clearExpiredLock($key = null)
 {
     parent::clearExpiredLock($key);
     if ($key) {
         $currDate = date($this->options->getDbDateTimeFormat());
         $delete = $this->gateway->getSql()->delete();
         $delete->where->lessThanOrEqualTo('end_datetime', $currDate)->and->like('key', "%{$this->separator}{$key}");
         $this->gateway->deleteWith($delete);
     }
 }