Skip to main content

memorydb-django

Django cache and session backends for MemoryDB. Two lines in settings.py, the way sqlite3 is a drop-in for Django itself — no models, no migrations, no new code in your views.

pip install memorydb-django
# settings.py
CACHES = {"default": {
    "BACKEND": "memorydb_django.MemoryDBCache",
    "LOCATION": "memorydb://TOKEN@127.0.0.1:8080",   # or leave empty and set MEMORYDB_URL
}}

SESSION_ENGINE = "memorydb_django.sessions"

Then use Django's own API:

from django.core.cache import cache
cache.set("hero", {"name": "Karna"}, timeout=30)   # one record; the TTL is the record's expiry
cache.get("hero")

request.session["user_id"] = 42                    # SESSION_COOKIE_AGE enforced server-side
request.session.save()

Details worth knowing:

  • Each cache key and each session is one MemoryDB document in the django_cache / django_sessions collection (typed, unique and indexed; created on first use).
  • timeout= and SESSION_COOKIE_AGE are stored as the record's own expires field, so the server stops serving them at the deadline. No cleanup cron, and clear_expired() is a no-op.
  • Concurrent writers use optimistic versions and retry, so there are no row locks or deadlocks.
  • Set MEMORYDB_SESSIONS_COLLECTION / OPTIONS["collection"] to move either store elsewhere, so two Django projects on one server stay apart.
  • Session values are stored through Django's own SESSION_SERIALIZER and signed with your SECRET_KEY, exactly as the database-backed store signs them, so sessions your site already issued keep working when you switch engines.

This is a cache/session backend, not a django.db backend — models, migrations, the admin and ORM queries still need Postgres or SQLite.

Metadata

Release files for memorydb-django 0.2.6

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

Source distribution (sdist)

Source distribution for memorydb-django 0.2.6
File Size Uploaded Provenance Actions
memorydb_django-0.2.6.tar.gz 4.7 kB With provenance Details for memorydb_django-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for memorydb-django 0.2.6
File Interpreter ABI Platform Actions
memorydb_django-0.2.6-py3-none-any.whl Python 3 none any Details for memorydb_django-0.2.6-py3-none-any.whl

Total release size: 10.7 kB

Release files / memorydb_django-0.2.6.tar.gz

Download URL memorydb_django-0.2.6.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab259e94bd2064be32bb01c95980cfefb274595411cb3a80cfc1a017e7759776
BLAKE2b-256 checksum
How to use checksums
391e4047057c941235d9892250c68358936671f6cc4a10b6a579c2600b4b715c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / memorydb_django-0.2.6-py3-none-any.whl

Download URL memorydb_django-0.2.6-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2abc3c7e4e20a314d21a88163b1bdc98e861de3adeef13f07fbdfe211270442
BLAKE2b-256 checksum
How to use checksums
f0dc1a8f4f73b3fc61294e16ca22cbbc27ea014fe18c6175c7f49158834e0f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for memorydb-django 0.2.6

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for memorydb_django-0.2.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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