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.2

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.2
File Size Uploaded Provenance Actions
memorydb_django-0.2.2.tar.gz 4.7 kB With provenance Details for memorydb_django-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 10.7 kB

Release files / memorydb_django-0.2.2.tar.gz

Download URL memorydb_django-0.2.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
01619de286841c624d532387f29437a7fe7b2934baffb7883695116421061478
BLAKE2b-256 checksum
How to use checksums
8677cd803746b1ccff28df0df130733944f07753048155ccf9a756a789d4d63e
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 4, 2026.

Transparency log

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

Download URL memorydb_django-0.2.2-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fb5916c06afd741ab4535dd217b2b23e55132392416e91fd88e3a695102da28
BLAKE2b-256 checksum
How to use checksums
6ac28467b6f82bcbe57590960705d1cb114dd13400707a89bbf4fe13a1bc3ecf
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 4, 2026.

Transparency log

Security for memorydb-django 0.2.2

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.2.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 4, 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