augusto2112 created this revision. augusto2112 added reviewers: clayborg, labath, jingham. Herald added a project: All. augusto2112 requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D131531 Files: lldb/include/lldb/Core/DataFileCache.h lldb/source/Core/DataFileCache.cpp Index: lldb/source/Core/DataFileCache.cpp =================================================================== --- lldb/source/Core/DataFileCache.cpp +++ lldb/source/Core/DataFileCache.cpp @@ -20,8 +20,6 @@ using namespace lldb_private; DataFileCache::DataFileCache(llvm::StringRef path) { - m_cache_dir.SetPath(path); - // Prune the cache based off of the LLDB settings each time we create a cache // object. ModuleListProperties &properties = @@ -40,6 +38,12 @@ policy.Expiration = std::chrono::hours(properties.GetLLDBIndexCacheExpirationDays() * 24); pruneCache(path, policy); + DataFileCache(path, policy); +} + +DataFileCache::DataFileCache(llvm::StringRef path, llvm::CachePruningPolicy policy) { + m_cache_dir.SetPath(path); + pruneCache(path, policy); // This lambda will get called when the data is gotten from the cache and // also after the data was set for a given key. We only need to take Index: lldb/include/lldb/Core/DataFileCache.h =================================================================== --- lldb/include/lldb/Core/DataFileCache.h +++ lldb/include/lldb/Core/DataFileCache.h @@ -14,6 +14,7 @@ #include "lldb/Utility/UUID.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/CachePruning.h" #include "llvm/Support/Caching.h" #include <mutex> @@ -40,12 +41,20 @@ class DataFileCache { public: - /// Create a data file cache in the directory path that is specified. + /// Create a data file cache in the directory path that is specified, using + /// the "LLDBIndexCache" settings as the basis for the policy. /// /// Data will be cached in files created in this directory when clients call /// DataFileCache::SetCacheData. DataFileCache(llvm::StringRef path); + /// Create a data file cache in the directory path that is specified, using + /// the specified policy. + /// + /// Data will be cached in files created in this directory when clients call + /// DataFileCache::SetCacheData. + DataFileCache(llvm::StringRef path, llvm::CachePruningPolicy policy); + /// Get cached data from the cache directory for the specified key. /// /// Keys must be unique for any given data. This function attempts to see if
Index: lldb/source/Core/DataFileCache.cpp =================================================================== --- lldb/source/Core/DataFileCache.cpp +++ lldb/source/Core/DataFileCache.cpp @@ -20,8 +20,6 @@ using namespace lldb_private; DataFileCache::DataFileCache(llvm::StringRef path) { - m_cache_dir.SetPath(path); - // Prune the cache based off of the LLDB settings each time we create a cache // object. ModuleListProperties &properties = @@ -40,6 +38,12 @@ policy.Expiration = std::chrono::hours(properties.GetLLDBIndexCacheExpirationDays() * 24); pruneCache(path, policy); + DataFileCache(path, policy); +} + +DataFileCache::DataFileCache(llvm::StringRef path, llvm::CachePruningPolicy policy) { + m_cache_dir.SetPath(path); + pruneCache(path, policy); // This lambda will get called when the data is gotten from the cache and // also after the data was set for a given key. We only need to take Index: lldb/include/lldb/Core/DataFileCache.h =================================================================== --- lldb/include/lldb/Core/DataFileCache.h +++ lldb/include/lldb/Core/DataFileCache.h @@ -14,6 +14,7 @@ #include "lldb/Utility/UUID.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/CachePruning.h" #include "llvm/Support/Caching.h" #include <mutex> @@ -40,12 +41,20 @@ class DataFileCache { public: - /// Create a data file cache in the directory path that is specified. + /// Create a data file cache in the directory path that is specified, using + /// the "LLDBIndexCache" settings as the basis for the policy. /// /// Data will be cached in files created in this directory when clients call /// DataFileCache::SetCacheData. DataFileCache(llvm::StringRef path); + /// Create a data file cache in the directory path that is specified, using + /// the specified policy. + /// + /// Data will be cached in files created in this directory when clients call + /// DataFileCache::SetCacheData. + DataFileCache(llvm::StringRef path, llvm::CachePruningPolicy policy); + /// Get cached data from the cache directory for the specified key. /// /// Keys must be unique for any given data. This function attempts to see if
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits