Skip to main content

beaker-mongodb

MongoDB backend for Beaker’s caching / session system.

Configuration

To set this up in your own project so that beaker can find it, it must define a setuptools entry point in your setup.py file. If you install from the egg distribution, beaker-mongodb setup.py SHOULD create a beaker.backend entry point. If you need to tweak it/see how it’s done or it just doesn’t work and you need to define your own, mine looks like this:

>>> entry_points="""
... [beaker.backends]
... mongodb = beaker.ext.mongodb:MongoDBNamespaceManager
... """,

With this defined, beaker should automatically find the entry point at startup (Beaker 1.4 and higher support custom entry points) and load it as an optional backend called ‘mongodb’.

There are more configuration options and details in the Beaker configuration docs [1].

I have a few cache regions in one of my applications, some of which are memcache and some are on mongodb. The region config looks like this:

>>> # new style cache settings
... beaker.cache.regions = comic_archives, navigation
... beaker.cache.comic_archives.type = libmemcached
... beaker.cache.comic_archives.url = 127.0.0.1:11211
... beaker.cache.comic_archives.expire = 604800
... beaker.cache.navigation.type = mongodb
... beaker.cache.navigation.url = mongodb://localhost:27017/beaker.navigation
... beaker.cache.navigation.expire = 86400

The Beaker docs[1] contain detailed information on configuring regions. The item we’re interested in here is the beaker.cache.navigation keys. Each beaker cache definition needs a type field, which defines which backend to use. Specifying mongodb will (if the module is properly installed) tell Beaker to cache via mongodb. Note that if Beaker cannot load the extension, it will tell you that mongodb is an invalid backend.

Expiration is standard beaker syntax, although not supported at the moment in this backend.

Finally, you need to define a URL to connect to MongoDB. This follows the standardized MongoDB URI Format[2]_.

If you want to use MongoDB’s optional authentication support, that is also supported. Simply define your URL as such:

>>> beaker.cache.navigation.url = mongodb://user@password@localhost:27017/beaker.navigation

Metadata

Release files for beaker-mongo 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 beaker-mongo 0.2.2
File Size Uploaded Provenance Actions
beaker-mongo-0.2.2.tar.gz 4.4 kB Without provenance Details for beaker-mongo-0.2.2.tar.gz

Release files / beaker-mongo-0.2.2.tar.gz

Download URL beaker-mongo-0.2.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
469ae9ce20bbba85caf8bdff5bf8df44165c1e46407f87ef68fa812abe4a9d2c
BLAKE2b-256 checksum
How to use checksums
b1d5243446e0d0ff08cfc67f02b32b0d0051dce4a7e248309235678934125abe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for beaker-mongo 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.

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.

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