Wouldn't it be more efficient to cache it as a map/array with UID as key and true as value ?