Cache invalid X-CS IDs

* Refactored to store an empty string as a signal that X-CS is invalid
* Fixed minor bug testing if the cached value is there

Change-Id: If6b4ee4faec21803c910f77372bdc0567448c563