python类SimpleCache()的实例源码

core.py 文件源码 项目:flask-ask 作者: johnwheeler 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, app=None, route=None, blueprint=None, stream_cache=None, path='templates.yaml'):
        self.app = app
        self._route = route
        self._intent_view_funcs = {}
        self._intent_converts = {}
        self._intent_defaults = {}
        self._intent_mappings = {}
        self._launch_view_func = None
        self._session_ended_view_func = None
        self._on_session_started_callback = None
        self._default_intent_view_func = None
        self._player_request_view_funcs = {}
        self._player_mappings = {}
        self._player_converts = {}
        if app is not None:
            self.init_app(app, path)
        elif blueprint is not None:
            self.init_blueprint(blueprint, path)
        if stream_cache is None:
            self.stream_cache = SimpleCache()
        else:
            self.stream_cache = stream_cache
sync.py 文件源码 项目:enjoliver 作者: JulienBalestra 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, api_uri: str, matchbox_path: str, ignition_dict: dict, extra_selector_dict=None):
        """
        :param api_uri: http://1.1.1.1:5000
        :param matchbox_path: /var/lib/matchbox
        :param ignition_dict: ignition.yaml
        """
        self.api_uri = api_uri
        os.environ["API_URI"] = self.api_uri
        self.matchbox_path = matchbox_path
        self.ignition_dict = ignition_dict
        self._reporting_ignitions()
        self.extra_selector = extra_selector_dict if extra_selector_dict else {}
        # inMemory cache for http queries
        if EC.sync_cache_ttl > 0:
            self._cache_query = SimpleCache(default_timeout=EC.sync_cache_ttl)
        else:
            self._cache_query = NullCache()
cache.py 文件源码 项目:Emoji-Web 作者: emoji-gen 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def make_cache():
    timeout = app.config['CACHE_TIMEOUT']
    if app.config['MEMCACHED_ENABLED']:
        hosts = app.config['MEMCACHED_HOSTS']
        return BinarySupportedMemcachedCache(hosts, default_timeout=timeout)

    return SimpleCache(default_timeout=timeout)
cache.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def test_get_dict(self):
        c = cache.SimpleCache()
        c.set('a', 'a')
        c.set('b', 'b')
        d = c.get_dict('a', 'b')
        assert 'a' in d
        assert 'a' == d['a']
        assert 'b' in d
        assert 'b' == d['b']
cache.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_set_many(self):
        c = cache.SimpleCache()
        c.set_many({0: 0, 1: 1, 2: 4})
        assert c.get(2) == 4
        c.set_many((i, i*i) for i in range(3))
        assert c.get(2) == 4
test_providers.py 文件源码 项目:gepify 作者: nvlbg 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def setUp(self):
        songs.cache = SimpleCache()
test_providers.py 文件源码 项目:gepify 作者: nvlbg 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setUp(self):
        songs.cache = SimpleCache()
test_providers.py 文件源码 项目:gepify 作者: nvlbg 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setUp(self):
        playlists.cache = SimpleCache()
test_providers.py 文件源码 项目:gepify 作者: nvlbg 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def setUp(self):
        playlists.cache = SimpleCache()
cache.py 文件源码 项目:FindYourCandy 作者: BrainPad 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        self.cache = SimpleCache(default_timeout=1800)
test_cache.py 文件源码 项目:flask-ask 作者: johnwheeler 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setUp(self):
        self.patcher = patch('flask_ask.core.find_ask', return_value=Ask())
        self.ask = self.patcher.start()
        self.user_id = 'dave'
        self.token = '123-abc'
        self.cache = SimpleCache()
cache.py 文件源码 项目:ctfscoreboard 作者: google 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, app):
        cache_type = app.config.get('CACHE_TYPE')
        if cache_type == 'memcached':
            host = app.config.get('MEMCACHE_HOST')
            self._cache = cache.MemcachedCache([host])
        elif cache_type == 'appengine':
            self._cache = cache.MemcachedCache()
        elif cache_type == 'local':
            self._cache = cache.SimpleCache()
        else:
            self._cache = cache.NullCache()
test_basic_app.py 文件源码 项目:flask-caching 作者: sh4nks 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_dict_config_initapp(app):
    cache = Cache()
    cache.init_app(app, config={'CACHE_TYPE': 'simple'})
    from werkzeug.contrib.cache import SimpleCache
    assert isinstance(app.extensions['cache'][cache], SimpleCache)
test_basic_app.py 文件源码 项目:flask-caching 作者: sh4nks 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_dict_config_both(app):
    cache = Cache(config={'CACHE_TYPE': 'null'})
    cache.init_app(app, config={'CACHE_TYPE': 'simple'})
    from werkzeug.contrib.cache import SimpleCache
    assert isinstance(app.extensions['cache'][cache], SimpleCache)
cache.py 文件源码 项目:Ostrich 作者: anantzoid 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        if webapp.config['APP_ENV'] == 'dev':
            from werkzeug.contrib.cache import SimpleCache
            self.cache = SimpleCache()
        else:
            from werkzeug.contrib.cache import MemcachedCache
            self.cache = MemcachedCache(['127.0.0.1:11211'])


问题


面经


文章

微信
公众号

扫码关注公众号