#34129CachingFramework: pdoBackend duplicate entry
Description
The function “set” in the PdoBackend checks if the hash exists and only then removes it.
if ($this->has($entryIdentifier)) {
$this->remove($entryIdentifier);
}
But the function “has” selects unexpired entries only. If the cache entry is expired it won’t be found by “has” and won’t get removed before the new entry is created. PDO throws an expection in this case, because “set” tries to add an already existing entry:
SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry ‘XXX’ for key ‘PRIMARY’
I suggest to fix this issue by always removing the entry when “set” is called, like the DbBackend does.
I don’t know if sqllite would just overwrite the entry. I use the PdoBackend with MySQL.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.