PR feedback

This commit is contained in:
Brad Davis 2017-06-16 20:04:23 -07:00
parent a675dfe7d2
commit 1632e3b35a

View file

@ -285,10 +285,12 @@ void FileCache::wipe() {
} }
void FileCache::clear() { void FileCache::clear() {
Lock lock(_mutex);
// Eliminate any overbudget files // Eliminate any overbudget files
clean(); clean();
// Mark everything remaining as persisted // Mark everything remaining as persisted while effectively ejecting from the cache
for (auto& file : _unusedFiles) { for (auto& file : _unusedFiles) {
file->_shouldPersist = true; file->_shouldPersist = true;
file->_cache = nullptr; file->_cache = nullptr;
@ -323,4 +325,4 @@ File::~File() {
void File::touch() { void File::touch() {
utime(_filepath.c_str(), nullptr); utime(_filepath.c_str(), nullptr);
_modified = std::max<int64_t>(QFileInfo(_filepath.c_str()).lastRead().toMSecsSinceEpoch(), _modified); _modified = std::max<int64_t>(QFileInfo(_filepath.c_str()).lastRead().toMSecsSinceEpoch(), _modified);
} }