Optimize cache saving code in situations when a cache tag is assigned to...

... the same key more than once