martinrusev / django-redis-sessions

Session backend for Django that stores sessions in a Redis database
BSD 3-Clause "New" or "Revised" License
494 stars 106 forks source link

ERROR when use request.session.clear_expired() #53

Closed korimas closed 6 years ago

korimas commented 6 years ago

Need to add clear_expired method like django/contrib/sessions/backends/cache.py:

    @classmethod
    def clear_expired(cls):
        pass

or it will raise NotImplementedError in django/contrib/sessions/backends/base.py

    @classmethod
    def clear_expired(cls):
        """
        Remove expired sessions from the session store.

        If this operation isn't possible on a given backend, it should raise
        NotImplementedError. If it isn't necessary, because the backend has
        a built-in expiration mechanism, it should be a no-op.
        """
        raise NotImplementedError

This error occured when we changed to use your SESSION_ENGINE and our code already use the method clear_expired