Plugin config lifecycle

Is it possible for a plugin to know when its configuration data has been modified? Suppose there is a configuration option that requires some initial parsing/processing that ideally should be done only once instead of on every request. For example, let’s say I have a logging plugin where I want to provide a configuration option to include/exclude certain http response codes. The config option might look like this to log only 4xx and 5xx responses:

“include”: “400-599”

Inside of log(), I can parse this config item to get the start/end range then verify that response status is in that range. However, I’d prefer to parse the config item once and then cache the start/end and re-use those for each request. I could certainly cache these values in global variables, etc., but if the plugin config is later updated, how can the plugin know to refresh its cached version? What is the lifecycle for refreshing plugin config values?

Hi, i think you can use the solution in this tread

Thanks for the pointer. That looks like an interesting approach.