public function FieldEncryptDatabaseCache::set in Field Encryption 7
Implements DrupalCacheInterface::set().
Overrides DrupalDatabaseCache::set
File
- ./
field_encrypt.cache.inc, line 101 - Field encryption cache classes.
Class
- FieldEncryptDatabaseCache
- Class FieldEncryptDatabaseCache.
Code
public function set($cid, $data, $expire = CACHE_PERMANENT) {
try {
$encrypted_data = $this
->encrypt($data);
} catch (Exception $e) {
watchdog_exception('field_encrypt', $e);
return;
}
$fields = array(
'serialized' => !is_string($data),
'created' => REQUEST_TIME,
'expire' => $expire,
'data' => $encrypted_data,
);
try {
db_merge($this->bin)
->key(array(
'cid' => $cid,
))
->fields($fields)
->execute();
} catch (Exception $e) {
// The database may not be available, so we'll ignore cache_set requests.
}
}