When using &drupal_static to cache variables how do I store an empty return result of null or false? I'm making an expensive soap call and would like to cache it even if it is empty through the duration of the script and page load. It's entirely possible that in the third party database the object is empty and null. I don't want to make five soap calls if the object is empty. I feel like using PHP empty() and isset() this way is hackish. It works but there is a lot of funky logic involved. Is there a better way? 

I need the drupal_static so if the $third_party_info_object is change anywhere else all the caches can get cleaned.

function my_module_get_information($user) {

  third_party_soap_initialize();

  $third_party_info = &amp;drupal_static(__FUNCTION__);

  if (!isset($third_party_info) &amp;&amp; is_null($third_party_info)) {
    // work some magic here
    $account_object = new thirdPartyAccounObject();
    $account_object-&gt;setThirdParyAccountId($user-&gt;uid);

    $third_party_info_object = new ThirdPartyInfo();
    $response = $third_party_info_object-&gt;getByAccount($account_object, false);

    $returnCode = {get the $returnCode here}

    if ($returnCode == 200) {
      $third_party_info = $response-&gt;getThirdPartyInfo();
    }
  }

  if (!isset($third_party_info)) {
    $third_party_info = false;
  }

  return $third_party_info;
}
drupal_static()'s default value is null. So instead of doing this

&lt;?php
$third_party_info = &amp;drupal_static(__FUNCTION__);
if (!isset($third_party_info) &amp;&amp; is_null($third_party_info)) {
?&gt;


Try this

&lt;?php
$third_party_info = &amp;drupal_static(__FUNCTION__);
if (is_null($third_party_info)) {
?&gt;