counter_tick_core: flush the cache (periodically)

Since we hold a lock, this is a good opportunity to flush the cache.
Note that this will only flush the cache periodically in the main
process when _aux_cache_threshold is exceeded.
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 982324c..e742358 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -837,6 +837,12 @@
 					self.settings._init_dirs()
 					write_atomic(self._counter_path, str(counter))
 			self._cached_counter = counter
+
+			# Since we hold a lock, this is a good opportunity
+			# to flush the cache. Note that this will only
+			# flush the cache periodically in the main process
+			# when _aux_cache_threshold is exceeded.
+			self.flush_cache()
 		finally:
 			self.unlock()