You are here

function WsfieldStorageDrupalDatabaseCache::set in Web Service Data 7

Implements DrupalCacheInterface::set().

Overrides DrupalDatabaseCache::set

File

modules/wsfields_storage/wsfields_storage.cache.inc, line 4

Class

WsfieldStorageDrupalDatabaseCache

Code

function set($cid, $data, $expire = CACHE_PERMANENT) {
  $cidparts = explode(':', $cid);
  if ($cidparts[0] == 'field' and wsfields_storage_entity_has_wsfields($cidparts[1]) and $expire == CACHE_PERMANENT) {
    $expirecid = 'wsfield_expire:' . $cidparts[1] . ':' . $cidparts[2];
    $expire = cache_get($expirecid);
    if ($expire) {
      $expire = $expire->data;
    }
    else {
      $expire = time() + variable_get('wsfields_min_expire', 300);
    }
  }
  parent::set($cid, $data, $expire);
}