Skip to main content

Django Cache With MongoDB

Installation and Usage

Install with:

$ pip install django-cache-with-mongodb

Add the following to your Django settings::

CACHES = {
    'default': {
        'BACKEND': 'django_cache_with_mongodb.MongoDBCache',
        "LOCATION": "[mongodb://][username:password@]host1[:port1][,...hostN[:portN]][/[defaultdb][?options]]",
        "OPTIONS": {
            "USERNAME": "username_if_desired",
            "PASSWORD": "password_if_needed",
            "DATABASE": "cache_db_name",  # in not supplied in URI
            "COLLECTION": "cache_collection",  # default: django_cache
            # Any Connection Options supported by pymongo
        },
        "TIMEOUT": 86400, # either set TIMEOUT or MAX_ENTRIES, not both
        "MAX_ENTRIES": 10000, # either set MAX_ENTRIES or TIMEOUT, not both
    }
}

LOCATION

Location supports MongoDB Connection String. Additionally, any supported pymongo parameters could be

OPTIONS

Any supported pymongo parameters could be added to OPTIONS.

Notice

The backend will handle TTL index creation if TIMEOUT is set, or will create a capped collection if MAX_ENTRIES is set. You should ensure that the collections are not created beforehands, so that the backend can do its work correctly.

Metadata

Release files for django-cache-with-mongodb 2024.11.27

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-cache-with-mongodb 2024.11.27
File Interpreter ABI Platform Actions
django_cache_with_mongodb-2024.11.27-py3-none-any.whl Python 3 none any Details for django_cache_with_mongodb-2024.11.27-py3-none-any.whl

Release files / django_cache_with_mongodb-2024.11.27-py3-none-any.whl

Download URL django_cache_with_mongodb-2024.11.27-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca6d96e1fc7adc70941ae99d935445ceac79ed29c741d7d0aa61f55baa49b410
BLAKE2b-256 checksum
How to use checksums
01004a229838668ac1067353b0d5e8216440e573ef7f36e467a38b8b2332fc3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Security for django-cache-with-mongodb 2024.11.27

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.

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

Release history Release notifications | RSS feed

This release

2024.11.27 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