Jerry's WIKIJerry's WIKI
Overview
  • 🐞 Web
  • 📐 Components
  • 💡 Skills
  • 🎱 Specification
  • đŸ–Ĩ Workflows
  • 🛠 Tools
  • đŸŒī¸ Linux
  • đŸ“Ļ Container
  • â™¨ī¸ Language
Coffee
  • įŽ€äŊ“中文
  • English
GitHub
Overview
  • 🐞 Web
  • 📐 Components
  • 💡 Skills
  • 🎱 Specification
  • đŸ–Ĩ Workflows
  • 🛠 Tools
  • đŸŒī¸ Linux
  • đŸ“Ļ Container
  • â™¨ī¸ Language
Coffee
  • įŽ€äŊ“中文
  • English
GitHub
  • đŸ–ŧ Images

    • Qrcode
    • Barcode
    • Captcha
  • 🔐 Locks

    • Redis Lock
    • Database Pessimistic Locking
    • Database Optimistic Locking
    • Queue(One Customer)
  • đŸĸ Offices

    • Export Excel
    • Export Csv
  • â†”ī¸ Encrypt

    • AES
    • RSA
    • AWS4
    • RC4
  • đŸĒ Login

    • JWT
    • Cookie
    • Session
    • Q&A
  • 📀 Servers

    • Server Notice
    • Deployment Process

Q&A

Index

  • Differences Between Cookie and Session
    • Differences
    • Similarities
  • Use Case

Differences Between Cookie and Session

Differences

  • Cookie stores information on the client-side (typically in the browser). Each request sends this information to the server through a special parameter, the Cookie.
  • Session stores information on the server-side. It uses the Cookie as a medium to mark a unique ID (SESSION_ID), which is then sent back to the server through the Cookie to retrieve the corresponding data.
  • Session can store sensitive, arbitrary format, and large size data, as the data is stored on the server.
  • Cookie can only store 4KB, non-sensitive, and ASCII-encoded data.
  • Typically, a site can store a maximum of 150 cookies.
  • A session can store nearly unlimited data.

Similarities

  • Both rely on the browser's Cookie mechanism.
  • Both have cross-origin issues. It is common for clients to request services from multiple domains.
  • Both can be used to track HTTP states.

Use Case

Personally, I prefer using JWT + Redis storage for API calls in HTTP Servers, as it eliminates the need to differentiate between client types and does not rely on the browser mechanism.


😅

Actually, these things are quite boring and don't have much significance. But I'll record them just to fill up the content.

Edit this page
Update At:
Contributor: į”°æœå¸†
Prev
Session
Next
Note