Cache: Remove item if putting fails
If an item cannot be put to the database, it is explicitly removed to ensure that we cannot have the situation that a stale item is continuously returned because the updating of the value fails for whatever reason.
This commit is contained in:
9
server/modules/filter/cache/cache.c
vendored
9
server/modules/filter/cache/cache.c
vendored
@ -1256,7 +1256,14 @@ static void store_result(CACHE_SESSION_DATA *csdata)
|
|||||||
|
|
||||||
if (result != CACHE_RESULT_OK)
|
if (result != CACHE_RESULT_OK)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Could not store cache item.");
|
MXS_ERROR("Could not store cache item, deleting it.");
|
||||||
|
|
||||||
|
result = csdata->api->delValue(csdata->storage, csdata->key);
|
||||||
|
|
||||||
|
if ((result != CACHE_RESULT_OK) || (result != CACHE_RESULT_NOT_FOUND))
|
||||||
|
{
|
||||||
|
MXS_ERROR("Could not delete cache item.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user