aboutsummaryrefslogtreecommitdiffstats
path: root/pym/_emerge/clear_caches.py
blob: 513df626ff0a68322a5f06f8d0185113b284b9c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import gc

def clear_caches(trees):
	for d in trees.values():
		d["porttree"].dbapi.melt()
		d["porttree"].dbapi._aux_cache.clear()
		d["bintree"].dbapi._aux_cache.clear()
		d["bintree"].dbapi._clear_cache()
		if d["vartree"].dbapi._linkmap is None:
			# preserve-libs is entirely disabled
			pass
		else:
			d["vartree"].dbapi._linkmap._clear_cache()
	gc.collect()