MXS-1475 Report if hard TTL has hit in

If an entry is not returned because the hard TTL had hit in,
we tell about it so that the caller can act differently in that
case.
This commit is contained in:
Johan Wikman
2018-03-15 09:48:44 +02:00
parent 38d20c1575
commit 4ce894d24d
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,8 @@ typedef enum cache_result_bits
CACHE_RESULT_ERROR = 0x03,
CACHE_RESULT_OUT_OF_RESOURCES = 0x04,
CACHE_RESULT_STALE = 0x10000 /*< Possibly combined with OK and NOT_FOUND. */
CACHE_RESULT_STALE = 0x10000, /*< Possibly combined with OK and NOT_FOUND. */
CACHE_RESULT_DISCARDED = 0x20000, /*< Possibly combined with NOT_FOUND. */
} cache_result_bits_t;
typedef uint32_t cache_result_t;
@ -39,6 +40,7 @@ typedef uint32_t cache_result_t;
#define CACHE_RESULT_IS_ERROR(result) (result & CACHE_RESULT_ERROR)
#define CACHE_RESULT_IS_OUT_OF_RESOURCES(result) (result & CACHE_RESULT_OUT_OF_RESOURCES)
#define CACHE_RESULT_IS_STALE(result) (result & CACHE_RESULT_STALE)
#define CACHE_RESULT_IS_DISCARDED(result) (result & CACHE_RESULT_DISCARDED)
typedef enum cache_flags
{

View File

@ -149,6 +149,7 @@ cache_result_t InMemoryStorage::do_get_value(const CACHE_KEY& key, uint32_t flag
if (is_hard_stale)
{
m_entries.erase(i);
result |= CACHE_RESULT_DISCARDED;
}
else if (!is_soft_stale || include_stale)
{