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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:56:53+00:00 2026-06-14T20:56:53+00:00

I am using sessions to store items in a users wish list. The wishlist

  • 0

I am using sessions to store items in a users wish list.

The wishlist is stored as a simple array of unique item ids –
An average user would store around 40 items in the wish list but it is possible that a user may wish to add as many as a few hundred items in their wish list.

I would like to generate a unique URL so that they can revisit their wishlist later, or share the wishlist with others who could use it as a starting point for their own lists.

I am not collecting any data from the user, and they will not have an account to link their wishlist data with.

The 2 methods of dealing with this that I am considering are:

Storing the data as a hash on the end of the URL, either as a url encoded serialised string or base64 encoded string.
This seems preferable as I will not need to store the wishlists and this offers a large amount of flexibility for users to modify existing lists, however I suspect that this will become unworkable if the number of items in the wishlist increases and the URL length grows beyond workable character counts.

OR

Generate a url with a unique Id and save the wishlist to the database. The problem I see with this is that a new entry will be added to the database every time a user wishes to generate a URL, and since these entries won’t be tied to any one user, a new entry will need to be generated every time a user makes any modification to a list.

Is there another better approach to handling this, or a way to manage the problems associated with the above methods?

  • 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-14T20:56:54+00:00Added an answer on June 14, 2026 at 8:56 pm

    I think going the database route will be the most flexible solution in the long run. Adding/removing records every time a user makes a selection shouldn’t be an issue as long as your data is well modeled. A “selection” should create no more than record referencing two things by key; a user, a product plus a quantity and price perhaps.

    That said, I would do it with a model similar to this:

    • product (id, …)
    • selection_set (id, name)
    • selection (product_id, selection_set_id, quantity, price)
    • wishlist (public_hash, selection_set_id)

    Wishlist is separate from selection_set because you could reuse selection_set for other things, like a shopping cart or order.

    Once that’s done, you can just store the public_hash in a cookie/session and give them a url to link to.

    Would that work for the scenario you had in mind? or are there any additional constraints?

    Alternate solutions:

    Even though I think the database is a viable solution, I can think of a couple of alternatives:

    Zip and encode data:

    You can take a comma separated list of wishlist item ids (or some sort of unique identifier), then base64_encode( gzinflate( $list ) ) and use that as your hash. You can then use gzdeflate( base64_decode( $hash ) ) to get your list of items. In order to avoid doing this on every page load, you can continue storing your selection within the session and only re-generate the hash when the list changes.

    gzdeflate + base64 should keep your hash within reasoable lengths for up to very large wishlist selections. You can write some unit tests to see how long a hash/list can get hypothetically.

    This method feels like a total hack 🙂

    Use Redis:

    You can set up a redis server and store wishlists on it. It’ll be persistent, scalable, fast and easy to access.

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

Sidebar

Related Questions

I'm using CodeIgniter with CodeIgniter sessions that are stored in a MySQL database. I
I have a virtual shopping cart using sessions (sessions stored in the DB). I
I have a site that stores an array in sessions. Items are added to
I am using the session object to store success/error messages based on user actions.
I'm trying to store the user's ID in the session using django.contrib.auth.login . But
i was developing my php application and using mysql to store session data and
I am using the following code to store values in aspx session. Code: $(div.menu_body
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
I tried to make admin panel and I am using sessions , but have
I have a website, im using sessions for the login. In every pages of

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.