Skip to main content

Provides caching ability through MongoDB. Forked and detached from django_mongodb_cash_backend.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file django_cache_with_mongodb-2024.10.31-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cache_with_mongodb-2024.10.31-py3-none-any.whl
Algorithm Hash digest
SHA256 d616d348031b229ab87d9b832df76ec99dd1ce821ea18252cfc00d7a1398b897
MD5 0f1d634f7e00f13e5766f7276ee3cd0b
BLAKE2b-256 b226a16c57dd1f6b2fc096d60ef9dc67aaf2853055e5e7599178efd5a81418af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page