MXS-2253 Runtime ttl changes are made in seconds

Internally durations are stored in milliseconds but runtime changes
using SQL are made in seconds. Consequently, the provided value must
be multiplied by 1000 before being stored.
This commit is contained in:
Johan Wikman
2019-04-11 15:53:45 +03:00
parent 74634abc80
commit 139651c092
2 changed files with 14 additions and 10 deletions

View File

@ -406,10 +406,10 @@ but only after it has explicitly been set once.
#### `@maxscale.cache.soft_ttl` #### `@maxscale.cache.soft_ttl`
Using the variable `@maxscale.cache.soft_ttl` it is possible to specify Using the variable `@maxscale.cache.soft_ttl` it is possible at runtime
at runtime what _soft ttl_ should be applied. Its initial value is the to specify _in seconds_ what _soft ttl_ should be applied. Its initial
value of the configuration parameter `soft_ttl`. That is, by default the value is the value of the configuration parameter `soft_ttl`. That is,
value is 0. by default the value is 0.
The purpose of this variable is make it possible for an application to decide The purpose of this variable is make it possible for an application to decide
statement by statement what _soft ttl_ should be applied. statement by statement what _soft ttl_ should be applied.
@ -436,10 +436,10 @@ but only after it has explicitly been set once.
#### `@maxscale.cache.hard_ttl` #### `@maxscale.cache.hard_ttl`
Using the variable `@maxscale.cache.hard_ttl` it is possible to specify Using the variable `@maxscale.cache.hard_ttl` it is possible at runtime
at runtime what _hard ttl_ should be applied. Its initial value is the to specify _in seconds_ what _hard ttl_ should be applied. Its initial
value of the configuration parameter `hard_ttl`. That is, by default the value is the value of the configuration parameter `hard_ttl`. That is,
value is 0. by default the value is 0.
The purpose of this variable is make it possible for an application to decide The purpose of this variable is make it possible for an application to decide
statement by statement what _hard ttl_ should be applied. statement by statement what _hard ttl_ should be applied.

View File

@ -1332,7 +1332,9 @@ char* CacheFilterSession::set_cache_soft_ttl(const char* zName,
if (get_uint32_value(pValue_begin, pValue_end, &value)) if (get_uint32_value(pValue_begin, pValue_end, &value))
{ {
m_soft_ttl = value; // The config value is stored in milliseconds, but runtime changes
// are made in seconds.
m_soft_ttl = value * 1000;
} }
else else
{ {
@ -1354,7 +1356,9 @@ char* CacheFilterSession::set_cache_hard_ttl(const char* zName,
if (get_uint32_value(pValue_begin, pValue_end, &value)) if (get_uint32_value(pValue_begin, pValue_end, &value))
{ {
m_hard_ttl = value; // The config value is stored in milliseconds, but runtime changes
// are made in seconds.
m_hard_ttl = value * 1000;
} }
else else
{ {