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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:31:00+00:00 2026-06-14T21:31:00+00:00

Trying to introduce caching/state-persisting into the middle tier of an application with a complex

  • 0

Trying to introduce caching/state-persisting into the middle tier of an application with a complex object layer (and a WCF service layer, not the focus here) running under IIS. Have settled on memcached/enyim as the caching architecture, and now need to get these objects serialized efficiently (speed and space) for it.

The object layer has a lot of pointers and interdependencies among objects, along these lines:

internal class SomeObj
{
    private string attr1;
    private int attr2;
    private OtherObj otherObj;
    private List<OtherOtherObj> otherObjs;
}

internal class OtherObj
{
    //...more attributes
}

internal class OtherOtherObj
{
    // you get the idea
}

Note that all fields are private. Also worth noting, most objects are internal, and many properties are either read-only (no set) or use set from a user perspective (i.e. make an object “dirty”), so cannot be used in rehydration. I have dozens of types that need caching.

I like the looks of both protobuf-net and msgpack, but I need to get the serialization done as fast as possible, with as little alteration of the existing architecture (which works well as is) as possible, and it seems like both of these have limited support for object hierarchies. I understand DTO-type serialization well, but am new to planning the right way to serialize an object for a cache. Can one of these tools work for me? Am I stuck using built-in .NET binary in order to work with a constructor, and repopulate attributes and objects on my own terms?

EDIT: just to clarify that last question–might make more sense if it read “Am I stuck using built-in .NET binary so that I can control the constructor, and repopulate attributes and objects on my own terms?

  • 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-06-14T21:31:01+00:00Added an answer on June 14, 2026 at 9:31 pm

    I can’t comment on msgpack, but yes: protobuf-net can do everything you’ve mentioned, including:

    • serialize non-public types
    • serialize private fields
    • serialize trees
    • constructor-skipping or user-provided factory (or just parameterless constructor)
    • serialize full/cyclic graphs (by explicitly marking the affected as references)
    • attribute usage, or runtime configuration without changing the DTO at all (although frankly, attributes are usually easier)
    • fast and compact output
    • inheritance support

    In the case of the example given, the simplest “does it work” test would be to just make the types with [ProtoContract] (there’s an optional setting in that attribute for constructor-skipping), and mark the fields as [ProtoMember(n)], for example n=1,2,3,… (unique in each type, but does not need to be unique between types)

    Other than the fact that we use Redis+BookSleeve rather than memcached+enyim, this is exactly what we do at Stack Exchange for object caching. Well, we also do a speculative gzip for large objects – if there is lots of string data, gzip can help shave off a few extra bytes.

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

Sidebar

Related Questions

So I'm trying to introduce some caching into my Asp.Net application. New data for
I am trying to introduce Automapper into an application for the first time, but
I'm trying to introduce myself into the MVVMCross project, but I can not run
I´m trying to retrieve the id of the object I've just introduced into the
I have been trying to introduce a Merge statement into the following SQL query
Im trying to introduce some logic into my jsp struts2 page. If a List
So I'm trying to introduce the concept of a user to my application and
I am trying to introduce this into my project, I did some search but
I'm not sure if this is possible, but I'm trying to introduce variation in
I am looking to introduce a logging framework into our existing Oracle application to

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.