':param cache_name: for ``sqlite`` backend: cache file will start with this prefix,
e.g ``cache.sqlite``
for ``mongodb``: it\'s used as database name
for ``redis``: it\'s used as the namespace. This means all keys
are prefixed with ``\'cache_name:\'``
:param backend: cache backend name e.g ``\'sqlite\'``, ``\'mongodb\'``, ``\'redis\'``, ``\'memory\'``.
(see :ref:`persistence`). Or instance of backend implementation.
:param expire_after: number of seconds after cache will be expired
or `None` (default) to ignore expiration
:type expire_after: float
:param allowable_codes: limit caching only for response with this codes (default: 200)
:type allowable_codes: tuple
:param allowable_methods: cache only requests of this methods (default: \'GET\')
:type allowable_methods: tuple
:kwarg backend_options: options for chosen backend. See corresponding
:ref:`sqlite <backends_sqlite>`, :ref:`mongo <backends_mongo>`
and :ref:`redis <backends_redis>` backends API documentation'

def __init__(self, cache_name='cache', backend='sqlite', expire_after=None, allowable_codes=(200,), allowable_methods=('GET',), **backend_options):

    if isinstance(backend, basestring):
        try:
            self.cache = backends.registry[backend](cache_name, **backend_options)
        except KeyError:
            raise ValueError(('Unsupported    backend    "%s"    try    one    of:    %s' % (backend, ',    '.join(backends.registry.keys()))))
    else:
        self.cache = backend
    self._cache_expire_after = expire_after
    self._cache_allowable_codes = allowable_codes
    self._cache_allowable_methods = allowable_methods
    self._is_cache_disabled = False
    super(CachedSession, self).__init__()
