You are here

function gardens_site_data_cache_set in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 acsf_init/lib/sites/g/sites.inc \gardens_site_data_cache_set()

Stores site info for a given domain in APC.

Parameters

string $domain: The domain name used in the cache key to store.

mixed $data: An array of data about the site/domain containing keys 'dir' and 'gardens_site_settings'. If the domain was not found in the sites.json then a scalar 0; if sites.json could not be read, then NULL.

2 calls to gardens_site_data_cache_set()
gardens_site_data_refresh_all in acsf_init/lib/sites/g/sites.inc
Fully refreshes the APC cached site/domain data, rewriting every key.
gardens_site_data_refresh_domains in acsf_init/lib/sites/g/sites.inc
Returns data for the specified domains directly from the JSON file.

File

acsf_init/lib/sites/g/sites.inc, line 560
ACSF helper functions for Drupal's multi-site directory aliasing feature.

Code

function gardens_site_data_cache_set($domain, $data) {
  if (extension_loaded('apcu') && ini_get('apc.enabled') && function_exists('apcu_store')) {
    if ($data === NULL) {
      $ttl = GARDENS_SITE_DATA_READ_FAILURE_TTL;
    }
    elseif ($data === 0) {
      $ttl = GARDENS_SITE_DATA_NOT_FOUND_TTL;
    }
    else {
      $ttl = GARDENS_SITE_DATA_TTL;
    }
    if ($ttl) {
      $domain_key = "gardens_domain:{$domain}";
      apcu_store($domain_key, $data, $ttl);
    }
  }
}