memcached.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:lifesoundtrack 作者: MTG 项目源码 文件源码
def __init__(self, server, params):
        import pylibmc
        super(PyLibMCCache, self).__init__(server, params,
                                           library=pylibmc,
                                           value_not_found_exception=pylibmc.NotFound)

        # The contents of `OPTIONS` was formerly only used to set the behaviors
        # attribute, but is now passed directly to the Client constructor. As such,
        # any options that don't match a valid keyword argument are removed and set
        # under the `behaviors` key instead, to maintain backwards compatibility.
        legacy_behaviors = {}
        for option in list(self._options):
            if option not in ('behaviors', 'binary', 'username', 'password'):
                warnings.warn(
                    "Specifying pylibmc cache behaviors as a top-level property "
                    "within `OPTIONS` is deprecated. Move `%s` into a dict named "
                    "`behaviors` inside `OPTIONS` instead." % option,
                    RemovedInDjango21Warning,
                    stacklevel=2,
                )
                legacy_behaviors[option] = self._options.pop(option)

        if legacy_behaviors:
            self._options.setdefault('behaviors', {}).update(legacy_behaviors)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号