* Automatically prune the file status cache every day.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1025 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-01-01 14:13:14 +00:00
parent 7abc459d74
commit 77a7d13b39
4 changed files with 21 additions and 4 deletions
+13
View File
@@ -68,4 +68,17 @@ FileStatusCache::insert(const std::string& path, int flags) {
return true;
}
void
FileStatusCache::prune() {
iterator itr = begin();
while (itr != end()) {
rak::file_stat fs;
iterator tmp = itr++;
if (!fs.update(rak::path_expand(tmp->first)) || tmp->second.m_mtime != (uint32_t)fs.modified_time())
base_type::erase(tmp);
}
}
}
+3 -4
View File
@@ -73,10 +73,9 @@ public:
// Add a function for pruning a sorted list of paths.
// Function for removing entries in a container that shouldn't be
// there based on some parameters.
// Function for pruning entries with different mtime or not existing.
// Function for pruning entries that no longer points to a file, or
// has a different mtime.
void prune();
};
}