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

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

Built distribution (wheel)

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

Total release size: 10.7 kB

Release files / memorydb_django-0.2.1.tar.gz

Download URL memorydb_django-0.2.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a8e6d365d0d5cae70c91623761c5ee1b7037f11045c1c84e6f2855340e256701
BLAKE2b-256 checksum
How to use checksums
9fd3da5a309757b2c0f9205c8f55f83d3a0325841f451d2ba49745a5e368dce2
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 Oct 31, 2026.

Transparency log

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

Download URL memorydb_django-0.2.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3adb4b96ea34c17b1340825fb11b656526dee1048f76cd46fa64c74c0f740086
BLAKE2b-256 checksum
How to use checksums
af1b95e9057f834e6b774e758acecbed53a396f7f5e37e31223320439fe54683
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 Oct 31, 2026.

Transparency log

Security for memorydb-django 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for memorydb_django-0.2.1.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 Oct 31, 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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full 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