Skip to content

Commit

Permalink
MDL-63466 core_message: rename cache for last message time
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson authored and snake committed Oct 24, 2018
1 parent fb04293 commit f978593
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lang/en/cache.php
Expand Up @@ -55,7 +55,7 @@
$string['cachedef_groupdata'] = 'Course group information';
$string['cachedef_htmlpurifier'] = 'HTML Purifier - cleaned content';
$string['cachedef_langmenu'] = 'List of available languages';
$string['cachedef_message_time_last_message_between_users'] = 'Time created for most recent message in a conversation';
$string['cachedef_message_time_last_message_in_conversation'] = 'Time created for most recent message in a conversation';
$string['cachedef_locking'] = 'Locking';
$string['cachedef_message_processors_enabled'] = "Message processors enabled status";
$string['cachedef_contextwithinsights'] = 'Context with insights';
Expand Down
4 changes: 2 additions & 2 deletions lib/db/caches.php
Expand Up @@ -343,11 +343,11 @@
),

// Caches the time of the last message in a conversation.
'message_time_last_message_between_users' => array(
'message_time_last_message_in_conversation' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true, // The conversation id is used.
'simplevalues' => true,
'datasource' => '\core_message\time_last_message_between_users',
'datasource' => '\core_message\time_last_message_in_conversation',
),

// Caches font awesome icons.
Expand Down
2 changes: 1 addition & 1 deletion lib/messagelib.php
Expand Up @@ -294,7 +294,7 @@ function message_send(\core\message\message $eventdata) {
if (!$eventdata->notification) {
if (!empty($eventdata->convid)) {
// Cache the timecreated value of the last message in this conversation.
$cache = cache::make('core', 'message_time_last_message_between_users');
$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);
}
Expand Down
2 changes: 1 addition & 1 deletion message/classes/api.php
Expand Up @@ -654,7 +654,7 @@ public static function get_conversation_messages(int $userid, int $convid, int $

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_between_users');
$cache = \cache::make('core', 'message_time_last_message_in_conversation');
$key = helper::get_last_message_time_created_cache_key($convid);
$lastcreated = $cache->get($key);

Expand Down
Expand Up @@ -35,9 +35,9 @@
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class time_last_message_between_users implements \cache_data_source {
class time_last_message_in_conversation implements \cache_data_source {

/** @var time_last_message_between_users the singleton instance of this class. */
/** @var time_last_message_in_conversation the singleton instance of this class. */
protected static $instance = null;

/**
Expand All @@ -49,7 +49,7 @@ class time_last_message_between_users implements \cache_data_source {
*/
public static function get_instance_for_cache(\cache_definition $definition) {
if (is_null(self::$instance)) {
self::$instance = new time_last_message_between_users();
self::$instance = new time_last_message_in_conversation();
}
return self::$instance;
}
Expand Down

0 comments on commit f978593

Please sign in to comment.