private static int GetLastProcessedId() { var id = LastProcessedId.GetId(); if (id == null) // first time, initialize with -1 { LastProcessedId.Insert(id: -1); id = -1; } return(id.Value); }
//private static void InvalidatePoliticianIssueAll() //{ // CachePoliticianIssuePages.TruncateTable(); //} //private static void InvalidatePoliticianIssueByIssuekey(string issueKey) //{ // CachePoliticianIssuePages.DeleteByIssueKey(issueKey); //} //private static void InvalidatePoliticianIssueByPoliticianKey( // string politicianKey) //{ // CachePoliticianIssuePages.DeleteByPoliticianKey(politicianKey); //} //private static void InvalidatePoliticianIssueByPoliticianKeyIssueKey( // string politicianKey, string issueKey) //{ // CachePoliticianIssuePages.DeleteByPoliticianKeyIssueKey( // politicianKey, issueKey); //} //private static void InvalidateReferendumAll() //{ // CacheReferendumPages.TruncateTable(); //} //private static void InvalidateReferendumByElectionkey(string electionKey) //{ // CacheReferendumPages.DeleteByElectionKey(electionKey); //} public static void ProcessPendingTransactions() { var lastId = GetLastProcessedId(); var table = CacheInvalidation.GetNewTransactions(lastId); foreach (var row in table) { ProcessTransaction(row); lastId = row.Id; } LastProcessedId.UpdateId(lastId); }