def clear_cache():
# flush file system buffers
os.sync()
# force kernel to drop clean caches
try:
subprocess.check_call("sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'",
stderr=subprocess.STDOUT,
universal_newlines=True,
shell=True)
except Exception as err:
print('Fail to drop clean caches: %s' % (err))
评论列表
文章目录