|
drogon
C++14/17-based HTTP application framework
|
The Hodor plugin implements a global rate limiter that limits the number of requests in a particular time unit. The json configuration is as follows: More...
#include <drogon/plugins/Hodor.h>


Public Member Functions | |
| void | initAndStart (const Json::Value &config) override |
| void | shutdown () override |
| void | setUserIdGetter (std::function< std::optional< std::string >(const HttpRequestPtr &)> func) |
| the method is used to set a function to get the user id from the request. users should call this method after calling the app().run() method. etc. use the beginning advice of AOP. | |
| void | setRejectResponseFactory (std::function< HttpResponsePtr(const HttpRequestPtr &)> func) |
| the method is used to set a function to create the response when the rate limit is exceeded. users should call this method after calling the app().run() method. etc. use the beginning advice of AOP. | |
| Public Member Functions inherited from drogon::PluginBase | |
| void | initialize () |
| This method must be called by drogon. | |
| Public Member Functions inherited from drogon::DrObject< Hodor > | |
| const std::string & | className () const override |
| Get the class name. | |
| bool | isClass (const std::string &class_name) const override |
| Return true if the class name is 'class_name'. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from drogon::DrObject< Hodor > | |
| static const std::string & | classTypeName () |
The Hodor plugin implements a global rate limiter that limits the number of requests in a particular time unit. The json configuration is as follows:
Enable the plugin by adding the configuration to the list of plugins in the configuration file.
|
overridevirtual |
This method must be called by drogon to initialize and start the plugin. It must be implemented by the user.
Implements drogon::PluginBase.
|
overridevirtual |
This method must be called by drogon to shutdown the plugin. It must be implemented by the user.
Implements drogon::PluginBase.