Good afternoon, I am writing with a"little" problem, I need to register the user's login to the site with caching his data.I have code, I use Flask-MySQL, Flask-Cache, I also use the Memcached module.Here's the code, will there be any ideas how to improve it?

1 Answers 1

What is the point of caching? IMHO, the cache is not needed in this particular case.
It is enough to store the session in encrypted form in browser cookies.

And this:
session['admin']=True
This is normal, if there is always one admin, but if there are several admins and you need to keep track of what they are doing there, then what to do?
Usually they write:
session['admin']=get['id']

P.S .: And using the word get as a variable is not comme il faut, due to the fact that it is a service word for extracting keys from dictionaries.
  • I need caching in order not to access the database every time when needed, and as I understood, caching for this case is not very secure – Dull2 Jul 15 '19 at 14:45
  • [[vessels]], in any case, in this case there is a 1 call to the database.That's all.
    But, if you want to cache the request itself, so cache it, although in this case it is useless.
    – Chinese Paintball Jul 15 '19 at 14:52
  • [[pcdesign]], well, thank you very much for the tips.I will cache the data when going to a certain page – Dull2 Jul 15 '19 at 14:55