protected function clear_messagecount($folder, $mode = array())
    {
        $a_folder_cache = $this->get_cache('messagecount');

        if (is_array($a_folder_cache[$folder])) {
            if (!empty($mode)) {
                foreach ((array) $mode as $key) {
                    unset($a_folder_cache[$folder][$key]);
                }
            }
            else {
                unset($a_folder_cache[$folder]);
            }
            $this->update_cache('messagecount', $a_folder_cache);
        }
    }