diff --git a/views_lang_switch.module b/views_lang_switch.module
index 92d4a42..e243f08 100644
--- a/views_lang_switch.module
+++ b/views_lang_switch.module
@@ -69,11 +69,18 @@ function views_lang_switch_configuration($form, &$form_state) {
  * Clear the cache.
  */
 function views_lang_switch_cache_clear_page($form, &$form_state) {
-  $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.');
 }
 
 /**
+ * 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() {
