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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:16:39+00:00 2026-05-30T17:16:39+00:00

I want to store serialized objects (or whatever) in a key/value cache. Now I

  • 0

I want to store serialized objects (or whatever) in a key/value cache.

Now I do something like this :

public string getValue(int param1, string param2, etc )
{
    string key = param1+"_"+param2+"_"+etc;

    string tmp = getFromCache();
    if (tmp == null)
    {
       tmp = getFromAnotherPlace();
       addToCache( key, tmp);
    }
    return tmp;
}

I think it can be awkward. How can I design the key?

  • 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-30T17:16:40+00:00Added an answer on May 30, 2026 at 5:16 pm

    if i understood the question, i think the simplest and smartest way to make a key is to use an unidirectional hash function as MD5, SHA1 ecc…

    At least two reason for doing this:

    1. The resulting key is unique for sure!(actually both MD5 and SHA1 have been cracked (= )
    2. The resulting key has a fixed lenght!

    You have to give your object as argument of the function and you have your unique key.
    I don t know very much c# but i am quite sure you can find an unidirectional hash function builted-in.

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

Sidebar

Related Questions

I have many JavaScript objects in my application, something like: function Person(age) { this.age
I store serialized data in the registry. I want to use a foreach loop
I want to store a a c# DateTimeOffset value in a SQL Server 2005
I have a file that contains java serialized objects like Vector. I have stored
In common-lisp, I want to implement a kind of reference system like this: Suppose
I want to store a serialized object somewhere and after looking around, realize there
We want to store a serialized object in a table along with a unique
I'm using Devart to execute DB object and Store Procedure mapping. Now i want
I want to store a graph of different objects for a game, their classes
I want to serialize a class to xml and store that in a field

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.