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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:06:56+00:00 2026-05-12T05:06:56+00:00

Abstract I am writing an application which has a few object caches. The way

  • 0

Abstract

I am writing an application which has a few object caches. The way it needs to work is when an object is retrieved from the cache:

object foo = CacheProvider.CurrentCache.Get("key");

foo should be a local copy of the original object, not a reference. What is the best way to implement this? The only way I have in mind so far is to use a BinarySerializer to create a copy, but I feel like I am missing a better way.

Details

The backing for the cache implementation is arbitrary, as it is provider-based. I need to support any number of caches, from the HttpRuntime cache to something like Velocity. The focus here is on the layer between the cache backing and the consumer code – that layer must ensure a copy of the object is returned. Some caches will already do this, but some do not (HttpRuntime cache being one).

  • 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-12T05:06:56+00:00Added an answer on May 12, 2026 at 5:06 am

    Rex – we implemented something very similar in a big enterprise web product, and we ended up explicitly creating an IDeepCloneable interface that many of our objects implemented. The interesting thing is that we backed it with BinarySerializer, simply because it’s a convienent and virtually foolproof way to make a deep copy of an object without all the hassle of reflection or forcing developers to write and test clone methods.

    It works like a charm. Our team has stopped to mull over it several times and we have yet to come up with a better option.

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

Sidebar

Related Questions

We're currently writing an application for which IT has already purchased hardware for. Their
I am writing a ZF application. I had some abstract parent classes in a
I am writing a Windows Forms application which is growing and becoming quite extensive.
I'm writing an application with a layered communications interface. This was done to abstract
I'm writing a .NET application and the thought of implementing a data layer from
I'm writing a .NET web application in which administrators can customize the various data
I am writing an application which requires the Master/Slave switch to happen inside the
I'm writing an application in which i have a set of code which i
I am writing an application that needs to interfaces with different backend systems. I
I'm writing a pretty simple database application, which I want to be locally stored

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.