Fix metadata cache

This commit is contained in:
Romain Neutron
2012-06-12 12:56:23 +02:00
parent 2e43a7b204
commit e8fb3dd77a
2 changed files with 10 additions and 2 deletions

View File

@@ -408,6 +408,8 @@ class caption_Field_Value implements cache_cacheableInterface
$record->get_caption()->delete_data_from_cache(); $record->get_caption()->delete_data_from_cache();
$databox_field->delete_data_from_cache(); $databox_field->delete_data_from_cache();
$caption_field_value->delete_data_from_cache();
return $caption_field_value; return $caption_field_value;
} }
@@ -534,7 +536,7 @@ class caption_Field_Value implements cache_cacheableInterface
*/ */
public function get_cache_key($option = null) public function get_cache_key($option = null)
{ {
return 'caption_fieldvalue_' . $this->id . '_' . $this->record->get_serialize_key() . ($option ? '_' . $option : ''); return 'caption_fieldvalue_' . $this->id . '_' . ($option ? '_' . $option : '');
} }
/** /**
@@ -575,6 +577,12 @@ class caption_Field_Value implements cache_cacheableInterface
{ {
$databox = $this->record->get_databox(); $databox = $this->record->get_databox();
$this->value = $this->VocabularyId = $this->VocabularyType = null; $this->value = $this->VocabularyId = $this->VocabularyType = null;
try {
$this->record->get_caption()->get_field($this->databox_field->get_name())->delete_data_from_cache();
} catch (\Exception $e) {
}
return $databox->delete_data_from_cache($this->get_cache_key($option)); return $databox->delete_data_from_cache($this->get_cache_key($option));
} }

View File

@@ -463,7 +463,7 @@ class caption_field implements cache_cacheableInterface
*/ */
public function get_cache_key($option = null) public function get_cache_key($option = null)
{ {
return 'caption_field_' . $this->record->get_serialize_key() . ($option ? '_' . $option : ''); return 'caption_field_' . $this->databox_field->get_id() . '_' . $this->record->get_serialize_key() . ($option ? '_' . $option : '');
} }
/** /**