I recently read a chapter of David Herman's Effective JavaScript[1] that talked about preserving the async contract even if you cache results (ie. can return without an async call from the caller). Try:
if (connectionInstance) {
setTimeout(function(){callback(connectionInstance)}, 0);
return;
}
That way your async functions will always behave the same way.