Skip to content

Commit

Permalink
Merge pull request xbmc#8288 from arnova/up_dir_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins4kodi committed Nov 1, 2015
2 parents e5f5177 + c3289bd commit 7a58dcb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xbmc/filesystem/DirectoryCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

#include <algorithm>

// Maximum number of directories to keep in our cache
#define MAX_CACHED_DIRS 50

using namespace XFILE;

CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType)
Expand Down Expand Up @@ -232,7 +235,6 @@ void CDirectoryCache::ClearCache(std::set<std::string>& dirs)
void CDirectoryCache::CheckIfFull()
{
CSingleLock lock (m_cs);
static const unsigned int max_cached_dirs = 10;

// find the last accessed folder, and remove if the number of cached folders is too many
iCache lastAccessed = m_cache.end();
Expand All @@ -247,7 +249,7 @@ void CDirectoryCache::CheckIfFull()
numCached++;
}
}
if (lastAccessed != m_cache.end() && numCached >= max_cached_dirs)
if (lastAccessed != m_cache.end() && numCached >= MAX_CACHED_DIRS)
Delete(lastAccessed);
}

Expand Down

0 comments on commit 7a58dcb

Please sign in to comment.