diff --git a/views_lang_switch.module b/views_lang_switch.module
index 5b0e1de..9202808 100644
--- a/views_lang_switch.module
+++ b/views_lang_switch.module
@@ -30,12 +30,19 @@ function views_lang_switch_menu() {
  * Clear the cache.
  */
 function views_lang_switch_cache_clear_page() {
-  $result = db_query('UPDATE cache_views_lang_switch SET expire = 1')->execute();
+  cache_clear_all('*', 'cache_views_lang_switch', TRUE);
   drupal_set_message('All items set to be expired.');
   return t('Cache clear');
 }
 
 /**
+ * Implements hook_flush_caches().
+ */
+function views_lang_switch_flush_caches() {
+  return array('cache_views_lang_switch');
+}
+
+/**
  * Implements hook_block_info().
  */
 function views_lang_switch_block_info() {
