From 2c49f90bc49ce896ce6eed0f6e96ba776a5d8f79 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 15 Mar 2018 13:15:46 +0200 Subject: [PATCH] MXS-1475 Allow caller to specify (soft|hard) TTL As the TTL is checked at lookup time, it need not be hardwired when the storage instance is created. With this changed it is possible to introduce @maxscale.cache.(soft|hard)_ttl user variables using which a client can control what TTL should be applied for a particular kind of data, which is requested by MXS-1475. --- server/modules/filter/cache/cache.hh | 2 ++ .../modules/filter/cache/cache_storage_api.h | 19 +++++++++++-- .../filter/cache/cachefiltersession.cc | 4 ++- .../filter/cache/cachefiltersession.hh | 2 ++ server/modules/filter/cache/cachept.cc | 6 ++-- server/modules/filter/cache/cachept.hh | 4 ++- server/modules/filter/cache/cachesimple.cc | 4 ++- server/modules/filter/cache/cachesimple.hh | 4 ++- server/modules/filter/cache/lrustorage.cc | 12 ++++++-- server/modules/filter/cache/lrustorage.hh | 6 +++- server/modules/filter/cache/lrustoragemt.cc | 4 ++- server/modules/filter/cache/lrustoragemt.hh | 2 ++ server/modules/filter/cache/lrustoragest.cc | 4 ++- server/modules/filter/cache/lrustoragest.hh | 2 ++ server/modules/filter/cache/storage.hh | 28 +++++++++++++++---- .../storage_inmemory/inmemorystorage.cc | 23 +++++++++++++-- .../storage_inmemory/inmemorystorage.hh | 8 ++++-- .../storage_inmemory/inmemorystoragemt.cc | 6 ++-- .../storage_inmemory/inmemorystoragemt.hh | 4 ++- .../storage_inmemory/inmemorystoragest.cc | 6 ++-- .../storage_inmemory/inmemorystoragest.hh | 4 ++- .../filter/cache/storage/storagemodule.hh | 4 ++- server/modules/filter/cache/storagereal.cc | 4 ++- server/modules/filter/cache/storagereal.hh | 2 ++ 24 files changed, 131 insertions(+), 33 deletions(-) diff --git a/server/modules/filter/cache/cache.hh b/server/modules/filter/cache/cache.hh index 84653745d..097fb4d05 100644 --- a/server/modules/filter/cache/cache.hh +++ b/server/modules/filter/cache/cache.hh @@ -119,6 +119,8 @@ public: */ virtual cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const = 0; /** diff --git a/server/modules/filter/cache/cache_storage_api.h b/server/modules/filter/cache/cache_storage_api.h index 3d23ba842..aa972ce82 100644 --- a/server/modules/filter/cache/cache_storage_api.h +++ b/server/modules/filter/cache/cache_storage_api.h @@ -209,17 +209,26 @@ typedef struct cache_storage_api * @param storage Pointer to a CACHE_STORAGE. * @param key A key generated with get_key. * @param flags Mask of cache_flags_t values. + * @param soft_ttl The soft TTL. A value if CACHE_USE_CONFIG_TTL (-1) indicates + * that the value specfied in the config, used in the creation, + * should be used. + * @param hard_ttl The hard TTL. A value if CACHE_USE_CONFIG_TTL (-1) indicates + * that the value specfied in the config, used in the creation, + * should be used. * @param result Pointer to variable that after a successful return will * point to a GWBUF. * * @return CACHE_RESULT_OK if item was found, CACHE_RESULT_NOT_FOUND if * item was not found or some other error code. In the OK an NOT_FOUND - * cased, the bit CACHE_RESULT_STALE is set if the item exists but the - * soft TTL has passed. + * cases, the bit CACHE_RESULT_STALE is set if the item exists but the + * soft TTL has passed. In the NOT_FOUND case, the but CACHE_RESULT_DISCARDED + * if the item existed but the hard TTL had passed. */ cache_result_t (*getValue)(CACHE_STORAGE* storage, const CACHE_KEY* key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** result); /** @@ -331,6 +340,12 @@ typedef struct cache_storage_api uint64_t* items); } CACHE_STORAGE_API; +#if defined __cplusplus +const uint32_t CACHE_USE_CONFIG_TTL = static_cast(-1); +#else +#define CACHE_USE_CONFIG_TTL ((uint32_t)-1) +#endif + #define CACHE_STORAGE_ENTRY_POINT "CacheGetStorageAPI" typedef CACHE_STORAGE_API* (*CacheGetStorageAPIFN)(); diff --git a/server/modules/filter/cache/cachefiltersession.cc b/server/modules/filter/cache/cachefiltersession.cc index 992cd446a..24210f293 100644 --- a/server/modules/filter/cache/cachefiltersession.cc +++ b/server/modules/filter/cache/cachefiltersession.cc @@ -190,6 +190,8 @@ CacheFilterSession::CacheFilterSession(MXS_SESSION* pSession, Cache* pCache, cha , m_is_read_only(true) , m_use(pCache->config().enabled) , m_populate(pCache->config().enabled) + , m_soft_ttl(pCache->config().soft_ttl) + , m_hard_ttl(pCache->config().hard_ttl) { m_key.data = 0; @@ -1024,7 +1026,7 @@ CacheFilterSession::routing_action_t CacheFilterSession::route_SELECT(cache_acti { uint32_t flags = CACHE_FLAGS_INCLUDE_STALE; GWBUF* pResponse; - cache_result_t result = m_pCache->get_value(m_key, flags, &pResponse); + cache_result_t result = m_pCache->get_value(m_key, flags, m_soft_ttl, m_hard_ttl, &pResponse); if (CACHE_RESULT_IS_OK(result)) { diff --git a/server/modules/filter/cache/cachefiltersession.hh b/server/modules/filter/cache/cachefiltersession.hh index 3b5d191f0..d4b50e01f 100644 --- a/server/modules/filter/cache/cachefiltersession.hh +++ b/server/modules/filter/cache/cachefiltersession.hh @@ -164,5 +164,7 @@ private: bool m_is_read_only;/**< Whether the current trx has been read-only in pratice. */ bool m_use; /**< Whether the cache should be used in this session. */ bool m_populate; /**< Whether the cache should be populated in this session. */ + uint32_t m_soft_ttl; /**< The soft TTL used in the session. */ + uint32_t m_hard_ttl; /**< The hard TTL used in the session. */ }; diff --git a/server/modules/filter/cache/cachept.cc b/server/modules/filter/cache/cachept.cc index 644ab2412..4dbbc70ed 100644 --- a/server/modules/filter/cache/cachept.cc +++ b/server/modules/filter/cache/cachept.cc @@ -130,9 +130,11 @@ cache_result_t CachePT::get_key(const char* zDefault_db, const GWBUF* pQuery, CA return thread_cache().get_key(zDefault_db, pQuery, pKey); } -cache_result_t CachePT::get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppValue) const +cache_result_t CachePT::get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppValue) const { - return thread_cache().get_value(key, flags, ppValue); + return thread_cache().get_value(key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t CachePT::put_value(const CACHE_KEY& key, const GWBUF* pValue) diff --git a/server/modules/filter/cache/cachept.hh b/server/modules/filter/cache/cachept.hh index 21266a910..df2a09e2e 100644 --- a/server/modules/filter/cache/cachept.hh +++ b/server/modules/filter/cache/cachept.hh @@ -32,7 +32,9 @@ public: cache_result_t get_key(const char* zDefault_db, const GWBUF* pQuery, CACHE_KEY* pKey) const; - cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppValue) const; + cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/cachesimple.cc b/server/modules/filter/cache/cachesimple.cc index b0e6902fd..031a94adf 100644 --- a/server/modules/filter/cache/cachesimple.cc +++ b/server/modules/filter/cache/cachesimple.cc @@ -52,9 +52,11 @@ bool CacheSimple::Create(const CACHE_CONFIG& config, cache_result_t CacheSimple::get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { - return m_pStorage->get_value(key, flags, ppValue); + return m_pStorage->get_value(key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t CacheSimple::put_value(const CACHE_KEY& key, diff --git a/server/modules/filter/cache/cachesimple.hh b/server/modules/filter/cache/cachesimple.hh index 0fee6f7e1..cee6ceb3c 100644 --- a/server/modules/filter/cache/cachesimple.hh +++ b/server/modules/filter/cache/cachesimple.hh @@ -25,7 +25,9 @@ class CacheSimple : public Cache public: ~CacheSimple(); - cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppValue) const; + cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/lrustorage.cc b/server/modules/filter/cache/lrustorage.cc index d220317f2..31b1978b3 100644 --- a/server/modules/filter/cache/lrustorage.cc +++ b/server/modules/filter/cache/lrustorage.cc @@ -74,9 +74,11 @@ cache_result_t LRUStorage::do_get_info(uint32_t what, cache_result_t LRUStorage::do_get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { - return access_value(APPROACH_GET, key, flags, ppValue); + return access_value(APPROACH_GET, key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t LRUStorage::do_put_value(const CACHE_KEY& key, const GWBUF* pvalue) @@ -171,7 +173,9 @@ cache_result_t LRUStorage::do_get_head(CACHE_KEY* pKey, GWBUF** ppValue) const while (m_pHead && (CACHE_RESULT_IS_NOT_FOUND(result))) { ss_dassert(m_pHead->key()); - result = do_get_value(*m_pHead->key(), CACHE_FLAGS_INCLUDE_STALE, ppValue); + result = do_get_value(*m_pHead->key(), + CACHE_FLAGS_INCLUDE_STALE, CACHE_USE_CONFIG_TTL, CACHE_USE_CONFIG_TTL, + ppValue); } if (CACHE_RESULT_IS_OK(result)) @@ -216,6 +220,8 @@ cache_result_t LRUStorage::do_get_items(uint64_t* pItems) const cache_result_t LRUStorage::access_value(access_approach_t approach, const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { cache_result_t result = CACHE_RESULT_NOT_FOUND; @@ -225,7 +231,7 @@ cache_result_t LRUStorage::access_value(access_approach_t approach, if (existed) { - result = m_pStorage->get_value(key, flags, ppValue); + result = m_pStorage->get_value(key, flags, soft_ttl, hard_ttl, ppValue); if (CACHE_RESULT_IS_OK(result)) { diff --git a/server/modules/filter/cache/lrustorage.hh b/server/modules/filter/cache/lrustorage.hh index 117ba12f4..ec8921c56 100644 --- a/server/modules/filter/cache/lrustorage.hh +++ b/server/modules/filter/cache/lrustorage.hh @@ -41,6 +41,8 @@ protected: */ cache_result_t do_get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const; /** @@ -89,13 +91,15 @@ private: cache_result_t access_value(access_approach_t approach, const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const; cache_result_t peek_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppValue) const { - return access_value(APPROACH_PEEK, key, flags, ppValue); + return access_value(APPROACH_PEEK, key, flags, CACHE_USE_CONFIG_TTL, CACHE_USE_CONFIG_TTL, ppValue); } /** diff --git a/server/modules/filter/cache/lrustoragemt.cc b/server/modules/filter/cache/lrustoragemt.cc index a4a029c90..aba1b93c6 100644 --- a/server/modules/filter/cache/lrustoragemt.cc +++ b/server/modules/filter/cache/lrustoragemt.cc @@ -47,11 +47,13 @@ cache_result_t LRUStorageMT::get_info(uint32_t what, cache_result_t LRUStorageMT::get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { SpinLockGuard guard(m_lock); - return do_get_value(key, flags, ppValue); + return do_get_value(key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t LRUStorageMT::put_value(const CACHE_KEY& key, const GWBUF* pValue) diff --git a/server/modules/filter/cache/lrustoragemt.hh b/server/modules/filter/cache/lrustoragemt.hh index 501f28c99..44bd3b492 100644 --- a/server/modules/filter/cache/lrustoragemt.hh +++ b/server/modules/filter/cache/lrustoragemt.hh @@ -28,6 +28,8 @@ public: cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, diff --git a/server/modules/filter/cache/lrustoragest.cc b/server/modules/filter/cache/lrustoragest.cc index 19ba0bbcc..927a9c092 100644 --- a/server/modules/filter/cache/lrustoragest.cc +++ b/server/modules/filter/cache/lrustoragest.cc @@ -41,9 +41,11 @@ cache_result_t LRUStorageST::get_info(uint32_t what, cache_result_t LRUStorageST::get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { - return LRUStorage::do_get_value(key, flags, ppValue); + return LRUStorage::do_get_value(key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t LRUStorageST::put_value(const CACHE_KEY& key, const GWBUF* pValue) diff --git a/server/modules/filter/cache/lrustoragest.hh b/server/modules/filter/cache/lrustoragest.hh index c391495bc..d1ba7e60d 100644 --- a/server/modules/filter/cache/lrustoragest.hh +++ b/server/modules/filter/cache/lrustoragest.hh @@ -27,6 +27,8 @@ public: cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, diff --git a/server/modules/filter/cache/storage.hh b/server/modules/filter/cache/storage.hh index 8213f0d9c..2cb1be141 100644 --- a/server/modules/filter/cache/storage.hh +++ b/server/modules/filter/cache/storage.hh @@ -47,20 +47,36 @@ public: /** * Get a value from the cache. * - * @param key A key generated with get_key. - * @param flags Mask of cache_flags_t values. - * @param ppValue Pointer to variable that after a successful return will - * point to a GWBUF. + * @param key A key generated with get_key. + * @param flags Mask of cache_flags_t values. + * @param soft_ttl The soft TTL. A value if CACHE_USE_CONFIG_TTL (-1) indicates + * that the value specfied in the config, used in the creation, + * should be used. + * @param hard_ttl The hard TTL. A value if CACHE_USE_CONFIG_TTL (-1) indicates + * that the value specfied in the config, used in the creation, + * should be used. + * @param ppValue Pointer to variable that after a successful return will + * point to a GWBUF. * * @return CACHE_RESULT_OK if item was found, CACHE_RESULT_NOT_FOUND if * item was not found or some other error code. In the OK an NOT_FOUND - * cased, the bit CACHE_RESULT_STALE is set if the item exists but the - * soft TTL has passed. + * cases, the bit CACHE_RESULT_STALE is set if the item exists but the + * soft TTL has passed. In the NOT_FOUND case, the but CACHE_RESULT_DISCARDED + * if the item existed but the hard TTL had passed. */ virtual cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const = 0; + cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, + GWBUF** ppValue) const + { + return get_value(key, flags, CACHE_USE_CONFIG_TTL, CACHE_USE_CONFIG_TTL, ppValue); + } + /** * Put a value to the cache. * diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc index 6b61ae49e..c8c90ce17 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc @@ -128,7 +128,9 @@ cache_result_t InMemoryStorage::do_get_info(uint32_t what, json_t** ppInfo) cons return *ppInfo ? CACHE_RESULT_OK : CACHE_RESULT_OUT_OF_RESOURCES; } -cache_result_t InMemoryStorage::do_get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult) +cache_result_t InMemoryStorage::do_get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult) { cache_result_t result = CACHE_RESULT_NOT_FOUND; @@ -138,12 +140,27 @@ cache_result_t InMemoryStorage::do_get_value(const CACHE_KEY& key, uint32_t flag { m_stats.hits += 1; + if (soft_ttl == CACHE_USE_CONFIG_TTL) + { + soft_ttl = m_config.soft_ttl; + } + + if (hard_ttl == CACHE_USE_CONFIG_TTL) + { + hard_ttl = m_config.hard_ttl; + } + + if (soft_ttl > hard_ttl) + { + soft_ttl = hard_ttl; + } + Entry& entry = i->second; uint32_t now = time(NULL); - bool is_hard_stale = m_config.hard_ttl == 0 ? false : (now - entry.time > m_config.hard_ttl); - bool is_soft_stale = m_config.soft_ttl == 0 ? false : (now - entry.time > m_config.soft_ttl); + bool is_hard_stale = hard_ttl == 0 ? false : (now - entry.time > hard_ttl); + bool is_soft_stale = soft_ttl == 0 ? false : (now - entry.time > soft_ttl); bool include_stale = ((flags & CACHE_FLAGS_INCLUDE_STALE) != 0); if (is_hard_stale) diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh index f778b0c36..a8e664041 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh @@ -32,7 +32,9 @@ public: void get_config(CACHE_STORAGE_CONFIG* pConfig); virtual cache_result_t get_info(uint32_t what, json_t** ppInfo) const = 0; - virtual cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult) = 0; + virtual cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult) = 0; virtual cache_result_t put_value(const CACHE_KEY& key, const GWBUF& value) = 0; virtual cache_result_t del_value(const CACHE_KEY& key) = 0; @@ -46,7 +48,9 @@ protected: const CACHE_STORAGE_CONFIG& config); cache_result_t do_get_info(uint32_t what, json_t** ppInfo) const; - cache_result_t do_get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult); + cache_result_t do_get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult); cache_result_t do_put_value(const CACHE_KEY& key, const GWBUF& value); cache_result_t do_del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc index f42ebbc34..697fc84fd 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc @@ -42,11 +42,13 @@ cache_result_t InMemoryStorageMT::get_info(uint32_t what, json_t** ppInfo) const return do_get_info(what, ppInfo); } -cache_result_t InMemoryStorageMT::get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult) +cache_result_t InMemoryStorageMT::get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult) { SpinLockGuard guard(m_lock); - return do_get_value(key, flags, ppResult); + return do_get_value(key, flags, soft_ttl, hard_ttl, ppResult); } cache_result_t InMemoryStorageMT::put_value(const CACHE_KEY& key, const GWBUF& value) diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh index c73bcef85..dad950a44 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh @@ -28,7 +28,9 @@ public: int argc, char* argv[]); cache_result_t get_info(uint32_t what, json_t** ppInfo) const; - cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult); + cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult); cache_result_t put_value(const CACHE_KEY& key, const GWBUF& value); cache_result_t del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc index 989189913..1a239be68 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc @@ -38,9 +38,11 @@ cache_result_t InMemoryStorageST::get_info(uint32_t what, json_t** ppInfo) const return do_get_info(what, ppInfo); } -cache_result_t InMemoryStorageST::get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult) +cache_result_t InMemoryStorageST::get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult) { - return do_get_value(key, flags, ppResult); + return do_get_value(key, flags, soft_ttl, hard_ttl, ppResult); } cache_result_t InMemoryStorageST::put_value(const CACHE_KEY& key, const GWBUF& value) diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh index cc0259456..9e9007e0f 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh @@ -27,7 +27,9 @@ public: int argc, char* argv[]); cache_result_t get_info(uint32_t what, json_t** ppInfo) const; - cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, GWBUF** ppResult); + cache_result_t get_value(const CACHE_KEY& key, + uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, + GWBUF** ppResult); cache_result_t put_value(const CACHE_KEY& key, const GWBUF& pValue); cache_result_t del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storagemodule.hh b/server/modules/filter/cache/storage/storagemodule.hh index bd87336f7..fb6454be1 100644 --- a/server/modules/filter/cache/storage/storagemodule.hh +++ b/server/modules/filter/cache/storage/storagemodule.hh @@ -71,6 +71,8 @@ public: static cache_result_t getValue(CACHE_STORAGE* pCache_storage, const CACHE_KEY* pKey, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppResult) { ss_dassert(pCache_storage); @@ -81,7 +83,7 @@ public: StorageType* pStorage = reinterpret_cast(pCache_storage); - MXS_EXCEPTION_GUARD(result = pStorage->get_value(*pKey, flags, ppResult)); + MXS_EXCEPTION_GUARD(result = pStorage->get_value(*pKey, flags, soft_ttl, hard_ttl, ppResult)); return result; } diff --git a/server/modules/filter/cache/storagereal.cc b/server/modules/filter/cache/storagereal.cc index 12571b805..be1eecde9 100644 --- a/server/modules/filter/cache/storagereal.cc +++ b/server/modules/filter/cache/storagereal.cc @@ -40,9 +40,11 @@ cache_result_t StorageReal::get_info(uint32_t flags, json_t** ppInfo) const cache_result_t StorageReal::get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const { - return m_pApi->getValue(m_pStorage, &key, flags, ppValue); + return m_pApi->getValue(m_pStorage, &key, flags, soft_ttl, hard_ttl, ppValue); } cache_result_t StorageReal::put_value(const CACHE_KEY& key, const GWBUF* pValue) diff --git a/server/modules/filter/cache/storagereal.hh b/server/modules/filter/cache/storagereal.hh index 26d96bb98..52d10a032 100644 --- a/server/modules/filter/cache/storagereal.hh +++ b/server/modules/filter/cache/storagereal.hh @@ -27,6 +27,8 @@ public: cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, + uint32_t soft_ttl, + uint32_t hard_ttl, GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key,