1. 程式人生 > >Flask元件之Flask-session

Flask元件之Flask-session

1、Flask模組中session與Flask-session元件中session的繼承關係:

  Flask模組sessions.py:

class SessionInterface(object):
    def open_session(self, app, request):
        raise NotImplementedError()

    def save_session(self, app, session, response):
        raise NotImplementedError()

class SecureCookieSessionInterface(SessionInterface):
    
def open_session(self, app, request): pass def save_session(self, app, session, response): pass

  flask-session元件sessions.py:

class SessionInterface(FlaskSessionInterface):
    pass

class NullSessionInterface(SessionInterface):
    pass
    
class RedisSessionInterface(SessionInterface):
    
pass class MemcachedSessionInterface(SessionInterface): pass class FileSystemSessionInterface(SessionInterface): pass class MongoDBSessionInterface(SessionInterface): pass class SqlAlchemySessionInterface(SessionInterface): pass