binary-newsreaderusenetqnaptautullifanartsickbeardtvseriesplexswizzinembyseedboxtvdbnzbgetsubtitlewebuiquickboxtraktkodistabletvshows
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
779 B
25 lines
779 B
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
requests_cache.backends.mongo
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
``mongo`` cache backend
|
|
"""
|
|
from .base import BaseCache
|
|
from .storage.mongodict import MongoDict, MongoPickleDict
|
|
|
|
|
|
class MongoCache(BaseCache):
|
|
""" ``mongo`` cache backend.
|
|
"""
|
|
def __init__(self, db_name='requests-cache', **options):
|
|
"""
|
|
:param db_name: database name (default: ``'requests-cache'``)
|
|
:param connection: (optional) ``pymongo.Connection``
|
|
"""
|
|
super(MongoCache, self).__init__()
|
|
self.responses = MongoPickleDict(db_name, 'responses',
|
|
options.get('connection'))
|
|
self.keys_map = MongoDict(db_name, 'urls', self.responses.connection)
|
|
|
|
|