Command
This class provides a management command to remove expired sessions from the database or storage backend. It interfaces with the configured session engine and executes its specific expiration cleanup logic if supported. The command is designed to be run manually or as a scheduled task to maintain session storage efficiency.
Attributes
| Attribute | Type | Description |
|---|---|---|
| help | string | Can be run as a cronjob or directly to clean out expired sessions when the backend supports it. |
Methods
handle()
@classmethod
def handle(
options: dict
) - > null
Executes the logic to clear expired sessions from the configured session engine. This method triggers the backend-specific cleanup process and raises a CommandError if the current session engine does not support clearing expired sessions.
Parameters
| Name | Type | Description |
|---|---|---|
| options | dict | A dictionary of command-line options and arguments passed to the command, used for configuring execution behavior. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the method performs an in-place cleanup of the session store. |