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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:12:17+00:00 2026-05-15T03:12:17+00:00

I am running into an odd problem, and this is the only thing I

  • 0

I am running into an odd problem, and this is the only thing I can think of. I’m storing a list in cache, and I am randomly losing items from my list as users use the site. I have a class that is called that either goes to cache and returns the list from there, or if the cache is over a certain time frame old, it goes to the database and refreshes the cache. So when I pull the data from cache, this is what it looks like….

results = (List<Software>)cache["software"];

And then I return results and do some processing, filter for security, and eventually it winds up on the screen. For each Software record, there can be multiple resources attached to it, and based on how the security goes they may see some, all, or none of the records. So in the security check it will remove some of those resources from the software record.

So my question is…. when I return my results list, is it a reference directly to the cache object? So when I remove a resource from the software object, it is really removing from cache as well? If that is the case, is there any way to not return it as a reference? Thanks!

edit: I think I may have just answered my own question…. so if I do something like this:

results = new List<Software>((List<Software>)cache["software"]);

it will copy the cached list to my results list, correct?

  • 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-15T03:12:18+00:00Added an answer on May 15, 2026 at 3:12 am

    You are referencing a single object. So if User A has some parts of the object changed, the User B will also see those changes.

    You should make a deep copy of this object after you get it from the cache, but before you filter it. That way you won’t run into this conflict. So the pseudo code would be something like this:

    var results = (List<Software>)cache["software"];
    var userresults = DeepCopyResults(results);
    var filteredresults = UserFilter(userresults);
    

    DeepCopyResults and UserFilter are functions defined by you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
I've been running into this problem with Flex for nearly a year, and each
I'm running into a rather odd problem with Ruby and File.chmod (same problem exists
I'm building my first Facebook Connect application, and am running into an odd problem.
I seem to be running into an odd problem. When using my GWT application
Running into a problem where on certain servers we get an error that the
I am currently running into a problem where an element is coming back from
I'm running into a problem setting up my development environment. I've been working on
I'm running into some very odd beheaviour regarding frames and internet explorer. The situation
Im running into a small (newbie) problem. I've got 2 models: question & reviews.

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.