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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:52:48+00:00 2026-05-21T13:52:48+00:00

For an application I’m working on I have a class that deals with the

  • 0

For an application I’m working on I have a class that deals with the requests sent to a webservice. To reduce traffic load I want to cache most of the requests and their results (at least for the content that won’t change often). A request is uniquely identified by the URL used, so I want to use the URL as a key.

In a previous project I worked on I used to create a md5 hash of the URL to function as a key. I’ve began wondering how safe this approach is, since apparently there’s quite a chance that 2 different URL’s produce the same hashed value.

Can anyone suggest a safer approach, or should I still stick with md5 hashes of the URL to function as a key in my cache dictionary?

  • 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-21T13:52:49+00:00Added an answer on May 21, 2026 at 1:52 pm

    Just use an NSMutableDictionary, with the URLs (as NSStrings) for the dictionary keys. NSDictionary (and NSMutableDictionary) are almost certainly implemented with some sort of hash table internally, but they will take care of any hash duplicate issues. If you give it a unique key, it will store it properly.

    Unless you’re sure that NSMutableDictionary is too slow for you needs (which it almost certainly won’t be), you don’t need to worry about hashing, collisions or anything like that. Just stick the data in your dictionary with a unique key (the URL).

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

Sidebar

Related Questions

Application use NHibernate. I Have object A that contains set of objects B. I
Application deals with strings that represent decimals that come from different cultures. For example
Application I am working on an MMO and have run into an issue. The
application design/architecture question for a project that I am building. I have a main
Application, have a TextBlock and two Buttons, the text is displayed TextBlock by clicking
Application : HTA (therefore IE) This is an application that uses SendKeys to populate
Application : I am working on one mid-large size application which will be used
Application-Stack: Rails3, CanCan, Devise, Shoulda I've got some nested Resources and want to test
The application I'm currently writing is using MVVM with the ViewModel-first pattern. I have
my application use 10 threads that to read a lot of html file.similar the

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.