How can I replace phpsession with cache and cookies?

Source: Internet
Author: User
Tags cache and cookies
The PHP 7 development framework I wrote myself has no session concept. I want users to use cache + cookies to solve the problem. In fact, I want to know, simple maintenance of user login using cookies symmetric encryption and storage, then php decrypts the table and session records the user uid, and then look up the table is actually nothing... the session concept is no longer found in the PHP 7 development framework I wrote myself.

I want users to use cache + cookies to solve the problem

In fact, I want to know, simply maintain user login

Store with cookies symmetric encryption and then decrypt the table in php
There is no essential difference between recording user uid and checking table with session

DIGRESS

It is not impossible for cookies to store users' hash passwords and usernames to simulate logon once each time.

In fact, the database or cached data should be comparable to the session's practicality

After all, the session has a recovery mechanism. When 0.1 million people log on to the website every day, the session mechanism may bring about a more cruel I/O bottleneck than the database bottleneck.

Another digress

The shopping cart implementation actually directly retrieves the cache
Key VALUE
User ID. shopping cart content
Actually, that's okay.
The details of the product information are in the form of a table or cache query.

I hope that you can tell me what the significance of using session is. since it is so random and unreliable

Reply content:

The session concept is no longer found in the PHP 7 development framework I wrote myself.

I want users to use cache + cookies to solve the problem

In fact, I want to know, simply maintain user login

Store with cookies symmetric encryption and then decrypt the table in php
There is no essential difference between recording user uid and checking table with session

DIGRESS

It is not impossible for cookies to store users' hash passwords and usernames to simulate logon once each time.

In fact, the database or cached data should be comparable to the session's practicality

After all, the session has a recovery mechanism. When 0.1 million people log on to the website every day, the session mechanism may bring about a more cruel I/O bottleneck than the database bottleneck.

Another digress

The shopping cart implementation actually directly retrieves the cache
Key VALUE
User ID. shopping cart content
Actually, that's okay.
The details of the product information are in the form of a table or cache query.

I hope that you can tell me what the significance of using session is. since it is so random and unreliable

1. do not put the user password information in the Cookie, even if it is encrypted, there is a security risk.
2. since the cache is used, it is better to directly access Redis. The product information and the user's shopping cart can be placed in the Redis Hash table.

No problem. that's what restful means.

The reason is that session is convenient.

Oh, you should not look up the table for every simulated login. it is better to get a redis or something to save the user information that has been logged in recently.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.