Skip to main content

By default, Django’s cached_db and db session backends loop through deleted sessions in order to trigger pre/post delete signal handlers. This can be extremely slow and consume a lot of CPU and memory on sites with a lot of sessions.

This package provides a SessionStoreMixin class and alternative cached_db and db backends that use the private _raw_delete() method, which is much faster and consumes much less CPU and memory, but does not trigger pre/post delete signal handlers.

Usage

Add to your settings:

SESSION_ENGINE = 'django_raw_clearsessions.cached_db'

Or:

SESSION_ENGINE = 'django_raw_clearsessions.db'

Or:

# mybackend.py
from some.package import some_backend
from django_raw_clearsessions import SessionStoreMixin


class SessionStore(SessionStoreMixin, some_backend.SessionStore):
    pass

# settings.py
SESSION_ENGINE = 'mybackend'

Execute the Django clearsessions management command:

$ python manage.py clearsessions

Metadata

Release files for django-raw-clearsessions 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-raw-clearsessions 0.1
File Interpreter ABI Platform
django_raw_clearsessions-0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / django_raw_clearsessions-0.1-py2.py3-none-any.whl

Download URL django_raw_clearsessions-0.1-py2.py3-none-any.whl
Size 2.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dadf4665bddf311c6414fc2d4630e7d98e07d4e1997d83f290b564f5d7204d8f
BLAKE2b-256 checksum
How to use checksums
ed92ad32222d18835b903d5e11118a2a8e1a3633af19fc5650f15859a2e7a95e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via devpi-server/4.7.1 (py2.7.3; linux2)

Security for django-raw-clearsessions 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page