store = $store; $this->max = $max; $this->window = $window; } /** * Counts one hit; false when this hit is over the limit. */ public function hit( string $key ): bool { return $this->store->incr( $key, $this->window ) <= $this->max; } /** * Whether the key is already over the limit, without counting a hit. */ public function exceeded( string $key ): bool { return $this->store->get( $key ) > $this->max; } }