diff --git a/lib/messagelib.php b/lib/messagelib.php index deca4e615d7..3fcaa94c6ea 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -295,8 +295,7 @@ function message_send(\core\message\message $eventdata) { if (!empty($eventdata->convid)) { // Cache the timecreated value of the last message in this conversation. $cache = cache::make('core', 'message_time_last_message_in_conversation'); - $key = \core_message\helper::get_last_message_time_created_cache_key($eventdata->convid); - $cache->set($key, $tabledata->timecreated); + $cache->set($eventdata->convid, $tabledata->timecreated); } } diff --git a/message/classes/api.php b/message/classes/api.php index 58fec61dab9..4eccf2be9b0 100644 --- a/message/classes/api.php +++ b/message/classes/api.php @@ -617,9 +617,8 @@ class api { } // Check the cache to see if we even need to do a DB query. - $cache = \cache::make('core', 'message_time_last_message_between_users'); - $key = helper::get_last_message_time_created_cache_key($conversationid); - $lastcreated = $cache->get($key); + $cache = \cache::make('core', 'message_time_last_message_in_conversation'); + $lastcreated = $cache->get($conversationid); // The last known message time is earlier than the one being requested so we can // just return an empty result set rather than having to query the DB. @@ -655,8 +654,7 @@ class api { if (!empty($timefrom)) { // Check the cache to see if we even need to do a DB query. $cache = \cache::make('core', 'message_time_last_message_in_conversation'); - $key = helper::get_last_message_time_created_cache_key($convid); - $lastcreated = $cache->get($key); + $lastcreated = $cache->get($convid); // The last known message time is earlier than the one being requested so we can // just return an empty result set rather than having to query the DB. diff --git a/message/classes/helper.php b/message/classes/helper.php index 0e35f67ab8f..237cd7c36aa 100644 --- a/message/classes/helper.php +++ b/message/classes/helper.php @@ -439,16 +439,6 @@ class helper { return sha1(implode('-', $userids)); } - /** - * Returns the cache key for the time created value of the last message of this conversation. - * - * @param int $convid The conversation identifier. - * @return string The key. - */ - public static function get_last_message_time_created_cache_key(int $convid) { - return $convid; - } - /** * Checks if legacy messages exist for a given user. *