Skip to content

Commit c266351

Browse files
committed
performance improvements:
- don't delete object_text from cache. They will be removed automatically since Object_Text also uses trait Delete - use function to retrieve the cache key
1 parent ad96201 commit c266351

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/Skeleton/Object/Delete.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,11 @@ public function delete() {
3232
$object_texts = \Skeleton\I18n\Object\Text::get_by_object($this);
3333
foreach ($object_texts as $object_text) {
3434
$object_text->delete();
35-
36-
if (self::trait_cache_enabled()) {
37-
$key = get_called_class() . '_' . $object_text->object_id . '_' . $object_text->label . '_' . $object_text->language->name_short;
38-
self::cache_delete($key);
39-
}
4035
}
4136
}
4237

4338
if (self::trait_cache_enabled()) {
44-
self::cache_delete(get_called_class() . '_' . $this->id);
39+
self::cache_delete(get_called_class()::trait_get_cache_key($this));
4540
}
4641

4742
$db->query('DELETE FROM ' . $db->quote_identifier($table) . ' WHERE ' . self::trait_get_table_field_id() . '=?', [$this->id]);

0 commit comments

Comments
 (0)