Fix logic error when reducing allocation in shared cache code.