You are here

function HTMLPurifier_DefinitionCache_Drupal::add in HTML Purifier 7.2

Same name and namespace in other branches
  1. 5 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::add()
  2. 6.2 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::add()
  3. 6 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::add()
  4. 7 HTMLPurifier_DefinitionCache_Drupal.php \HTMLPurifier_DefinitionCache_Drupal::add()

Add an object to the cache without overwriting

File

./HTMLPurifier_DefinitionCache_Drupal.php, line 12

Class

HTMLPurifier_DefinitionCache_Drupal

Code

function add($def, $config) {
  if (!$this
    ->checkDefType($def)) {
    return;
  }
  $key = $this
    ->generateKey($config);
  if ($this
    ->fetchFromDrupalCache($key)) {

    // already cached
    return FALSE;
  }
  $this
    ->storeInDrupalCache($def, $key);
  return TRUE;
}