PROXY:atomic_counter_sub(counter_name, value)
Subtracts a value from the specified atomic counter name.
Syntax
PROXY:atomic_counter_sub(counter_name, value);
Arguments
| Name | Description |
|---|---|
| counter_name |
A Lua string as the name of the counter. This parameter is mandatory. |
|
value |
A Lua number to be subtracted from the counter. This cannot exceed the current counter value as the counter cannot be a negative number. |
Events
All events except: PERSISTENCE, POST_PERSIST.
Example
when HTTP_REQUEST {
counter_name = "DemoCounter1"
value = 10
ret = PROXY:atomic_counter_sub(counter_name, value)
if ret then
debug("===>>atomic_counter_sub success: [%s]=[%d]\n", counter_name, value)
else
debug("===>>atomic_counter_sub failed: [%s]=[%d]\n", counter_name, value)
end
}
Supported Version
FortiADC version 7.6.0 and later.