I am working on a permission system. In each page it will need to check whether if the user's token is correct.
I have two choices, store token in a session variable or query the database to check the token every time before allowing the user to use the service.
If I store in a session variable if the session is expired I query the database to check if the token exists and recreate the session.
Which is faster or better?
It's for android and website permission system by an REST API.