| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function storeData($key, $data, $expiration) |
||
| 30 | { |
||
| 31 | $store = igbinary_serialize(array('data' => $data, 'expiration' => $expiration)); |
||
| 32 | if (null === $expiration) { |
||
| 33 | return $this->redis->set($this->makeKeyString($key), $store); |
||
| 34 | } else { |
||
| 35 | $ttl = $expiration - time(); |
||
| 36 | |||
| 37 | // Prevent us from even passing a negative ttl'd item to redis, |
||
| 38 | // since it will just round up to zero and cache forever. |
||
| 39 | if ($ttl < 1) { |
||
| 40 | return true; |
||
| 41 | } |
||
| 42 | |||
| 43 | return $this->redis->setex($this->makeKeyString($key), $ttl, $store); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 53 |