B
[ @ s d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dlmZm Z d dl
mZmZ d dl
mZmZ eeZdadadaG dd d eZG d
d deZdS ) )pickleN)datetime)OpenResourceNamespaceManager Container)InvalidCacheBackendErrorMissingCacheParameter)file_synchronizernull_synchronizer)verify_directorySyncDictc @ s~ e Zd Ze Ze Zedd ZdddZdd Z d
d Z
dd
Zdd Zdd Z
dd Zdd Zdd Zdd Zdd ZdS )DatabaseNamespaceManagerc C sR t d k rd S y$dd la dd lma ddlma W n tk
rL tdY nX d S )Nr )typesz8Database cache backend requires the 'sqlalchemy' library)sa
sqlalchemyZsqlalchemy.poolpoolr
ImportErrorr )cls r D/opt/alt/python37/lib/python3.7/site-packages/beaker/ext/database.py_init_dependencies s z+DatabaseNamespaceManager._init_dependenciesNFbeaker_cachec s t | | dkri d| _|r*|| _n|r8|d | _| jrHt| j pR d }
fdd}i | _d| _d| _tj |
|| _
dS )aT Creates a database namespace manager
``url``
SQLAlchemy compliant db url
``sa_opts``
A dictionary of SQLAlchemy keyword options to initialize the engine
with.
``optimistic``
Use optimistic session locking, note that this will result in an
additional select when updating a cache value to compare version
numbers.
``table_name``
The table name to use in the database for the cache.
``schema_name``
The schema name to use in the database for the cache.
Nz/container_db_lockzsa.urlc s } fdd}t j| |}tj|tjdtjddtjdtddd tjd
tj dd tjdtj dd tjdtj
dd tdrn|jd
}|j
dd |S )Nc s&