| @@ 42-51 (lines=10) @@ | ||
| 39 | return $this->getRateInfo($key); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function createRate($key, $limit, $period) { |
|
| 43 | $info = array(); |
|
| 44 | $info['limit'] = $limit; |
|
| 45 | $info['calls'] = 1; |
|
| 46 | $info['reset'] = time() + $period; |
|
| 47 | ||
| 48 | $this->client->save($key, $info, $period); |
|
| 49 | ||
| 50 | return $this->getRateInfo($key); |
|
| 51 | } |
|
| 52 | ||
| 53 | public function resetRate($key) { |
|
| 54 | $this->client->delete($key); |
|
| @@ 46-56 (lines=11) @@ | ||
| 43 | return $this->getRateInfo($key); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function createRate($key, $limit, $period) |
|
| 47 | { |
|
| 48 | $info = array(); |
|
| 49 | $info['limit'] = $limit; |
|
| 50 | $info['calls'] = 1; |
|
| 51 | $info['reset'] = time() + $period; |
|
| 52 | ||
| 53 | $this->client->set($key, $info, $period); |
|
| 54 | ||
| 55 | return $this->getRateInfo($key); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function resetRate($key) |
|
| 59 | { |
|