Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loading user info upon login?

    A user logs in, I want to get a list of all of the user id's he's following so I won't have to get it again later on, or all the comments he likes so loading comments is easier. I'm guessing I'll have to cache that data, but I'm not quite sure how. How? Also, is this conventional for social services to do? If not, what is? Thanks.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,348
    Thanks
    23
    Thanked 618 Times in 617 Posts
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    Thank you for your answer. I'm already using $_SESSION to store the user's ID and name. However, is it a good idea to store arrays on $_SESSION like that? Plus what about space on the server/other things?

  • #4
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I use $_SESSION to store the user's ID and name, but I don't know if it's a good idea to store arrays. I'm also considering space efficiency and just overall efficiency.

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,348
    Thanks
    23
    Thanked 618 Times in 617 Posts
    Quote Originally Posted by undefined12 View Post
    I use $_SESSION to store the user's ID and name, but I don't know if it's a good idea to store arrays. I'm also considering space efficiency and just overall efficiency.
    If your going to
    I want to get a list of all of the user id's he's following so I won't have to get it again later on
    Your going to store them someplace. Mox nix (macht nichts if your German) where you do it.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,198
    Thanks
    80
    Thanked 4,453 Times in 4,418 Posts
    Think about the numbers. It's dirt simple.

    Say you have 50 session variables *PER USER*. (Surely that is overkill!)

    Say each session variable NAME is 12 characters long and each session variable VALUE is 32 characters long. That's 48 characters. Make it 64 to be safe. Make it 2 bytes per character for UTF8. 128 bytes per value. Times 50. 6400 bytes.

    Now let's say you have 10,000 SIMULTANEOUS users (how likely is that??? but assume it anyway). That is 640,000,000 bytes. LESS than 1 GB of memory. If you have an 8GB system, that's no load at all on the system.

    Now work this all out again using your OWN numbers.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •