private static int ProcessTransaction(CacheInvalidationRow row) { var count = 0; switch (row.TransactionType.ToLowerInvariant()) { case "all": count += InvalidateAll(); break; case "nagsall": // no action needed on common db apart from // updating IsCommonCacheInvalidated break; case "politicianimage": // no action needed on common db apart from // updating IsCommonCacheInvalidated break; default: throw new VoteException( "Unidentified invalidation transaction type" + row.TransactionType); } CacheInvalidation.UpdateIsCommonCacheInvalidatedById(true, row.Id); return(count); }
//private static int InvalidatePoliticianIssueAll() //{ // var count = CachePoliticianIssuePages.CountTable(0); // CachePoliticianIssuePages.TruncateTable(); // return count; //} //private static int InvalidatePoliticianIssueByIssuekey(string issueKey) //{ // return CachePoliticianIssuePages.DeleteByIssueKey(issueKey); //} //private static int InvalidatePoliticianIssueByPoliticianKey( // string politicianKey) //{ // return CachePoliticianIssuePages.DeleteByPoliticianKey(politicianKey); //} //private static int InvalidatePoliticianIssueByPoliticianKeyIssueKey( // string politicianKey, string issueKey) //{ // return CachePoliticianIssuePages.DeleteByPoliticianKeyIssueKey( // politicianKey, issueKey); //} //private static int InvalidateReferendumAll() //{ // var count = CacheReferendumPages.CountTable(0); // CacheReferendumPages.TruncateTable(); // return count; //} //private static int InvalidateReferendumByElectionkey(string electionKey) //{ // return CacheReferendumPages.DeleteByElectionKey(electionKey); //} private static int ProcessTransaction(CacheInvalidationRow row) { var count = 0; switch (row.TransactionType.ToLowerInvariant()) { case "all": count += InvalidateAll(); break; //case "ballotall": // count += InvalidateBallotAll(); // break; //case "ballotbydomaindesigncodeelectionkey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // count += InvalidateBallotByDomainDesignCodeElectionKey(keys[0], keys[1]); // } // break; //case "ballotbyelectionkey": // count += InvalidateBallotByElectionKey(row.CacheKey); // break; //case "electedall": // count += InvalidateElectedAll(); // break; //case "electedbystatecode": // count += InvalidateElectedByStateCode(row.CacheKey); // break; //case "electionall": // count += InvalidateElectionAll(); // break; //case "electionbyelectionkey": // count += InvalidateElectionByElectionKey(row.CacheKey); // break; //case "introall": // count += InvalidateIntroAll(); // break; //case "introbypoliticiankey": // count += InvalidateIntroByPoliticianKey(row.CacheKey); // break; //case "issueall": // count += InvalidateIssueAll(); // break; //case "issuebyissuekey": // count += InvalidateIssueByIssueKey(row.CacheKey); // break; //case "issuebyofficekey": // count += InvalidateIssueByOfficeKey(row.CacheKey); // break; //case "issuebyelectionkeyofficekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // count += InvalidateIssueByElectionKeyOfficeKey(keys[0], keys[1]); // } // break; //case "issuebyofficekeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // count += InvalidateIssueByOfficeKeyIssueKey(keys[0], keys[1]); // } // break; //case "issuebyelectionkeyofficekeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 3) // count += InvalidateIssueByElectionKeyOfficeKeyIssueKey( // keys[0], keys[1], keys[2]); // } // break; case "nagsall": // no action needed on common db apart from // updating IsCommonCacheInvalidated break; //case "officialsall": // count += InvalidateOfficialsAll(); // break; //case "officialsbystatecode": // count += InvalidateOfficialsByStateCode(row.CacheKey); // break; //case "officialsbystatecodecountycode": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // count += InvalidateOfficialsByStateCodeCountyCode(keys[0], keys[1]); // } // break; //case "officialsbystatecodecountycodelocalcode": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 3) // count += InvalidateOfficialsByStateCodeCountyCodeLocalCode( // keys[0], keys[1], keys[2]); // } // break; case "politicianimage": // no action needed on common db apart from // updating IsCommonCacheInvalidated break; //case "politicianissueall": // count += InvalidatePoliticianIssueAll(); // break; //case "politicianissuebyissuekey": // count += InvalidatePoliticianIssueByIssuekey(row.CacheKey); // break; //case "politicianissuebypoliticiankey": // count += InvalidatePoliticianIssueByPoliticianKey(row.CacheKey); // break; //case "politicianissuebypoliticiankeyissuekey": // { // var keys = row.CacheKey.Split('|'); // if (keys.Length == 2) // count += InvalidatePoliticianIssueByPoliticianKeyIssueKey(keys[0], keys[1]); // } // break; //case "referendumall": // count += InvalidateReferendumAll(); // break; //case "referendumbyelectionkey": // count += InvalidateReferendumByElectionkey(row.CacheKey); // break; default: throw new VoteException( "Unidentified invalidation transaction type" + row.TransactionType); } CacheInvalidation.UpdateIsCommonCacheInvalidatedById(true, row.Id); return(count); }