Skip to content

Commit

Permalink
To qb (#9).
Browse files Browse the repository at this point in the history
To qb (#9).
  • Loading branch information
darkdef committed Oct 13, 2021
1 parent 9b68843 commit 3c7cef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DbCache.php
Expand Up @@ -214,7 +214,7 @@ private function getData($id, array $fields, string $method)
->from($this->table)
->select($fields)
->where(['id' => $id])
->andWhere('(expire IS NULL OR expire > ' . time() . ')')
->andWhere(['OR', ['expire' => null], ['>', 'expire', time()]])
->{$method}()
;
}
Expand Down Expand Up @@ -272,7 +272,7 @@ private function gc(): void
{
if (random_int(0, 1000000) < $this->gcProbability) {
$this->db->createCommand()
->delete($this->table, 'expire > 0 AND expire < ' . time())
->delete($this->table, ['AND', ['>', 'expire', 0], ['<', 'expire', time()]])
->execute()
;
}
Expand Down

0 comments on commit 3c7cef5

Please sign in to comment.