1 | <?php |
||
31 | class ElasticWindowThrottler implements RetriableThrottlerInterface, \Countable |
||
32 | { |
||
33 | /* @var CacheAdapterInterface */ |
||
34 | protected $cache; |
||
35 | /* @var string */ |
||
36 | protected $key; |
||
37 | /* @var int */ |
||
38 | protected $limit; |
||
39 | /* @var int */ |
||
40 | protected $ttl; |
||
41 | /* @var int */ |
||
42 | protected $counter; |
||
43 | |||
44 | /** |
||
45 | * @param CacheAdapterInterface $cache |
||
46 | * @param string $key |
||
47 | * @param int $limit |
||
48 | * @param int $ttl |
||
49 | */ |
||
50 | 14 | public function __construct(CacheAdapterInterface $cache, $key, $limit, $ttl) |
|
57 | |||
58 | /** |
||
59 | * @inheritdoc |
||
60 | */ |
||
61 | 4 | public function access() |
|
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | 10 | public function hit() |
|
81 | |||
82 | /** |
||
83 | * @inheritdoc |
||
84 | */ |
||
85 | 2 | public function clear() |
|
93 | |||
94 | /** |
||
95 | * @inheritdoc |
||
96 | */ |
||
97 | 12 | public function count() |
|
111 | |||
112 | /** |
||
113 | * @inheritdoc |
||
114 | */ |
||
115 | 8 | public function check() |
|
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | public function getTime() |
||
127 | |||
128 | /** |
||
129 | * @inheritdoc |
||
130 | */ |
||
131 | public function getLimit() |
||
135 | |||
136 | /** |
||
137 | * @inheritdoc |
||
138 | */ |
||
139 | 1 | public function getRetryTimeout() |
|
147 | } |
||
148 |