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 6757491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:39:37+00:00 2026-05-26T13:39:37+00:00

Have problem while getting data from Memcached on .NET MVC solution. I have this

  • 0

Have problem while getting data from Memcached on .NET MVC solution.

I have this custom repository:

public List<DropDownLocalization> GetLocalization(string key, string lang)
        {
            var result = cacheClient.Get<IQueryable<DropDownLocalization>>("DD_" + key + "_" + lang);
            if (result == null)
            {
                int getLangId = _db.languages.Where(d => d.Association == lang).Select(d => d.Id).FirstOrDefault();
                int getLableItemId = _db.lables_dropdown.Where(d => d.Key == key).Select(d => d.Id).FirstOrDefault();
                var get = _db.lables_dropdown_items.Where(d => d.LableId == getLableItemId).Select(d => new DropDownLocalization
                                                    {
                                                        DDId = d.Id,
                                                        DDName = d.lables_dropdown_values.Where(m => m.Language == getLangId).Select(m => m.Value).FirstOrDefault()
                                                    }).AsQueryable();
                cacheClient.Store(StoreMode.Add, "DD_" + key + "_" + lang, (IQueryable<DropDownLocalization>)get);
                EFQueryLogger.WriteQuery(((ObjectQuery)get).ToTraceString());
                return get.ToList();
            }
            return result.ToList();
        }

It’s get list of drop down labels localized from current lang.

So it’s trying to get data from cache, if not success put data to cache. While i comment part of code with “if” statement (just to see if it’s get data data from cache) i have error of null reference. It’s mean that request response is not in the cache.

Can somebody put my nose to the problem?

There is my enym client library config:

<enyim.com>
    <memcached protocol="Text">
      <servers>
                <add address="localhost" port="11211" />
      </servers>
      <socketPool deadTimeout="00:00:10" />
    </memcached>
  </enyim.com>
  • 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-26T13:39:37+00:00Added an answer on May 26, 2026 at 1:39 pm

    Solution found. Unfortunately it was my mistakes. There is the practice how to store data model in memcached.

    I have model:

    [Serializable]
        public class DropDownLocalization
        {
            public int DDId { get; set; }
            public string DDName { get; set; }
        }
    

    And method that return result:

    public List<DropDownLocalization> GetLocalization(string key, string lang)
            {
               List<DropDownLocalization> result = MemcachedSingleton.Instance.Get<List<DropDownLocalization>>("DD_" + key + "_" + lang);
               if (result == null)
               {
                   int getLangId = _db.languages.Where(d => d.Association == lang).Select(d => d.Id).FirstOrDefault();
                   int getLableItemId = _db.lables_dropdown.Where(d => d.Key == key).Select(d => d.Id).FirstOrDefault();
                   result = _db.lables_dropdown_items.Where(d => d.LableId == getLableItemId).Select(d => new DropDownLocalization
                                                       {
                                                           DDId = d.Id,
                                                           DDName = d.lables_dropdown_values.Where(m => m.Language == getLangId).Select(m => m.Value).FirstOrDefault()
                                                       }).ToList();
                   MemcachedSingleton.Instance.Store(StoreMode.Add, "DD_" + key + "_" + lang, result);
                   return result;
               }
               return result;
            }
    

    It’s fully working now.

    Config should be next:

    <enyim.com>
        <memcached protocol="Text">
          <servers>
            <add address="localhost" port="11211" />
          </servers>
          <transcoder type="Enyim.Caching.Memcached.DataContractTranscoder, Enyim.Caching" />
          <socketPool deadTimeout="00:00:10" />
        </memcached>
      </enyim.com>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a serious problem with getting data from a sql query in php
I have a problem while scrolling images on tableview. I am getting a Signal
I have problem while using jquery maskedinput with asp.net textbox. I have a check
Hey dudes.i am having this problem while symlinking. I have successfully deployed a ruby
I have this problem I've been trying to tackle for a while. I have
First, I had a problem with getting the data from the Database, it took
i am getting the web services from the .net web server. while in the
i need to get data along with images from .net web server. i have
I have a problem while converting a string whose value is dd.mm.yyyy to DateTime
I have a problem while pasting my contents (or text) generated by Java code

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.