aboutsummaryrefslogtreecommitdiff
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-08-06 00:50:05 +0100
committerGravatar Sadie Powell2023-08-06 00:50:05 +0100
commitcd6784021f39d09ab6b29261e43aea5fd96cc00c (patch)
tree8cca6af782f26f199d53df38cbe750d06662b26e /src/configreader.cpp
parentMake ldapauth take an enum field for the username field. (diff)
Make config file cache invalidation more useful.
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 9f6c80f67..47dd87fc6 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -92,13 +92,13 @@ ServerConfig::ServerConfig()
{
}
-ServerConfig::ReadResult ServerConfig::ReadFile(const std::string& file, bool invalidate)
+ServerConfig::ReadResult ServerConfig::ReadFile(const std::string& file, time_t mincache)
{
auto contents = filecontents.find(file);
if (contents != filecontents.end())
{
- if (!invalidate)
- return ReadResult(contents->second, {});
+ if (!mincache || contents->second.second >= mincache)
+ return ReadResult(contents->second.first, {});
filecontents.erase(contents);
}
@@ -129,8 +129,8 @@ ServerConfig::ReadResult ServerConfig::ReadFile(const std::string& file, bool in
datastream.write(databuf, len);
}
- filecontents[name] = datastream.str();
- return ReadResult(filecontents[name], {});
+ filecontents[name] = { datastream.str(), ServerInstance->Time() };
+ return ReadResult(filecontents[name].first, {});
}
void ServerConfig::CrossCheckOperBlocks()