Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 874253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:04:34+00:00 2026-05-15T11:04:34+00:00

I have the following code: private bool CheckForDuplicatesInCache(Message theMessage) { var cacheClient = MemcachedClient.GetInstance(IntegrationCache);

  • 0

I have the following code:

private bool CheckForDuplicatesInCache(Message theMessage)
{
    var cacheClient = MemcachedClient.GetInstance("IntegrationCache");
    var messageHash = theMessage.GetHashCode();
    if (cacheClient.Get(messageHash.ToString()).IsNotNull())
    {
        IntegrationContext.WriteLog("Warning: This message is a duplicate. Will Not Process.");
        return false;
    }           

    cacheClient.Set(messageHash.ToString(), "nothing", new TimeSpan(2, 0, 0));

    return true;
}

The problem is, when I scale this to multiple servers…I need to have multiple memcached intances that share data for redundancy. Does anyone have any insight?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:04:35+00:00Added an answer on May 15, 2026 at 11:04 am

    There are 2 ways you could theoretically do it:

    There is a product called repcached, however it only runs on linux right now. It has the ability to replicate the cache to a different server.

    The other option is in code: you could write the value to BOTH caches and check for it in both chaches. If you add more than 2 servers, you could do it in a for loop.

            private bool CheckForDuplicatesInCache(Message theMessage)
        {
            var cacheClient = MemcachedClient.GetInstance("IntegrationCache");
            var cacheClient2 = MemcachedClient.GetInstance("IntegrationCache2");
            var messageHash = theMessage.GetHashCode();
            if (cacheClient.Get(messageHash.ToString()).IsNotNull())
            {
                IntegrationContext.WriteLog("Warning: This message is a duplicate. Will Not Process.");
                return false;
            }
    
            if (cacheClient2.Get(messageHash.ToString()).IsNotNull())
            {
                IntegrationContext.WriteLog("Warning: This message is a duplicate. Will Not Process.");
                return false;
            }
    
            cacheClient.Set(messageHash.ToString(), "nothing", new TimeSpan(2, 0, 0));
            cacheClient2.Set(messageHash.ToString(), "nothing", new TimeSpan(2, 0, 0));
            return true;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How about something along the following lines: for(set<int>::const_iterator iter1 =… May 16, 2026 at 12:20 pm
  • Editorial Team
    Editorial Team added an answer In VS 2010 you can import and export breakpoints, if… May 16, 2026 at 12:20 pm
  • Editorial Team
    Editorial Team added an answer (I originally misunderstood the question based on the title, but… May 16, 2026 at 12:20 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have the following method in my code: private bool GenerateZipFile(List<FileInfo> filesToArchive, DateTime archiveDate)
I have the following code: private SetMultimap<String, Dynamic> dynamicFields = TreeMultimap.create(Ordering.natural(), new Comparator<Dynamic>() {
I have the following code: [SuppressMessage( Microsoft.Performance, CA1800:DoNotCastUnnecessarily )] private static void SetTestConnectionString( Component
I have the following code: class Foo { public Foo() { Size = true;
i have the following code that does a image rollover on pictureboxes located inside
I have the following code that responds to a button click, changes the view
I have the following code and it does not delete the rows, it asks
I am trying to detect JavaScript in my querystrings value. I have the following
Is there a way to release com objects at application crash? I have the
I have a map which displays some info. By default, labels on the map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.