Skip to content

Commit

Permalink
Merge pull request #1595 from Expensify/ionatan_logscache
Browse files Browse the repository at this point in the history
Add some logging around cache invalidation
  • Loading branch information
tylerkaraszewski authored Oct 18, 2023
2 parents 229e014 + 0f5a742 commit 7de1ae4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/Cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ bool BedrockCacheCommand::peek(SQLite& db) {
SASSERT(result[0].size() == 2);
response["name"] = result[0][0];
response.content = result[0][1];
SINFO("Pushing " << response["name"] << " to LRU cache");

// Update the LRU Map
plugin()._lruMap.pushMRU(response["name"]);
Expand Down Expand Up @@ -261,6 +262,7 @@ void BedrockCacheCommand::process(SQLite& db) {
auto popResult = plugin()._lruMap.popLRU();
const string& name = (popResult.second ? popResult.first : db.read("SELECT name FROM cache LIMIT 1"));
SASSERT(!name.empty());
SINFO("Deleting " << response["name"] << " from the cache");

// Delete it
if (!db.write("DELETE FROM cache WHERE name=" + SQ(name) + ";")) {
Expand Down

0 comments on commit 7de1ae4

Please sign in to comment.