From 139651c09246027bd8cf0e37be639dddee9ceafb Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 11 Apr 2019 15:53:45 +0300 Subject: [PATCH] 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. --- Documentation/Filters/Cache.md | 16 ++++++++-------- .../modules/filter/cache/cachefiltersession.cc | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Documentation/Filters/Cache.md b/Documentation/Filters/Cache.md index 56ac5fd3d..6d8600ffe 100644 --- a/Documentation/Filters/Cache.md +++ b/Documentation/Filters/Cache.md @@ -406,10 +406,10 @@ but only after it has explicitly been set once. #### `@maxscale.cache.soft_ttl` -Using the variable `@maxscale.cache.soft_ttl` it is possible to specify -at runtime what _soft ttl_ should be applied. Its initial value is the -value of the configuration parameter `soft_ttl`. That is, by default the -value is 0. +Using the variable `@maxscale.cache.soft_ttl` it is possible at runtime +to specify _in seconds_ what _soft ttl_ should be applied. Its initial +value is the value of the configuration parameter `soft_ttl`. That is, +by default the value is 0. The purpose of this variable is make it possible for an application to decide 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` -Using the variable `@maxscale.cache.hard_ttl` it is possible to specify -at runtime what _hard ttl_ should be applied. Its initial value is the -value of the configuration parameter `hard_ttl`. That is, by default the -value is 0. +Using the variable `@maxscale.cache.hard_ttl` it is possible at runtime +to specify _in seconds_ what _hard ttl_ should be applied. Its initial +value is the value of the configuration parameter `hard_ttl`. That is, +by default the value is 0. The purpose of this variable is make it possible for an application to decide statement by statement what _hard ttl_ should be applied. diff --git a/server/modules/filter/cache/cachefiltersession.cc b/server/modules/filter/cache/cachefiltersession.cc index 7790403cc..18aeeaa1f 100644 --- a/server/modules/filter/cache/cachefiltersession.cc +++ b/server/modules/filter/cache/cachefiltersession.cc @@ -1332,7 +1332,9 @@ char* CacheFilterSession::set_cache_soft_ttl(const char* zName, 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 { @@ -1354,7 +1356,9 @@ char* CacheFilterSession::set_cache_hard_ttl(const char* zName, 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 {