php - How to limit the flow of the api interface (not targeting IP, and users), how to implement
巴扎黑
巴扎黑 2017-06-22 11:53:06
0
1
1899

Just like the title.
Interface limits the number of accesses for the same user (device)

巴扎黑
巴扎黑

reply all(1)
世界只因有你

Since the question has laravel in the tag, I recommend the ready-made solution, https://github.com/dingo/api. This package has a feature Rate Limiting, which should be what you are looking for.

If you want to implement it yourself, it is simple. Use [user_id + device unique code] as the primary key, store the number of visits in redis, record the number of visits, and then the specific frequency and number of times all depend on your implementation strategy

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!