think-throttle icon indicating copy to clipboard operation
think-throttle copied to clipboard

有考虑支持注解吗

Open ken678 opened this issue 10 months ago • 3 comments

Image

ken678 avatar Mar 03 '25 07:03 ken678

惊艳到我了,还能这么酷啊。需要研究一下。

hongweipeng avatar Mar 03 '25 08:03 hongweipeng

惊艳到我了,还能这么酷啊。需要研究一下。

https://www.workerman.net/q/13595 截图这是webman的,和tp相似度很高的 ,大概就是通过中间件的通过反射读取注解信息 ,这种注解自由度就非常高了

对应库:https://github.com/webman-php/rate-limiter 逻辑:https://github.com/webman-php/rate-limiter/blob/f6ff79366ab56ac66bc507515d747cdef752db2d/src/Limiter.php#L69

ken678 avatar Mar 03 '25 09:03 ken678

收到

hongweipeng avatar Mar 03 '25 09:03 hongweipeng

@hongweipeng 你好作者,通过注解方式,$key 传不了闭包 Closure 类型吧?我想自定义 key 要怎么实现,是不是用不了注解方式了

Image

我看了下 webman 是可以传入静态方法来自定义的,用我们的 think- throttle 要怎么实现?

Image

yusureabc avatar Oct 11 '25 09:10 yusureabc

@yusureabc 注解好像是传不了闭包。这个功能我后面改善一下。

hongweipeng avatar Nov 21 '25 03:11 hongweipeng

@yusureabc 已支持,发布为测试版,v3.0.0-alpha2

hongweipeng avatar Nov 21 '25 06:11 hongweipeng