当前位置: 首页>>代码示例>>Python>>正文


Python cache.BingoCache类代码示例

本文整理汇总了Python中gae_bingo.cache.BingoCache的典型用法代码示例。如果您正苦于以下问题:Python BingoCache类的具体用法?Python BingoCache怎么用?Python BingoCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BingoCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_experiments

    def get_experiments(self, archives=False):
        if archives:
            bingo_cache = BingoCache.load_from_datastore(archives=True)
        else:
            bingo_cache = BingoCache.get()

        return str(bingo_cache.experiments)
开发者ID:dguiley,项目名称:gae_bingo,代码行数:7,代码来源:run_step.py

示例2: delete_all_experiments

    def delete_all_experiments(self):
        bingo_cache = BingoCache.get()
        for experiment_name in bingo_cache.experiments.keys():
            bingo_cache.delete_experiment_and_alternatives(bingo_cache.get_experiment(experiment_name))

        bingo_cache_archives = BingoCache.load_from_datastore(archives=True)
        for experiment_name in bingo_cache_archives.experiments.keys():
            bingo_cache_archives.delete_experiment_and_alternatives(
                bingo_cache_archives.get_experiment(experiment_name)
            )

        return len(bingo_cache.experiments) + len(bingo_cache_archives.experiments)
开发者ID:humble,项目名称:gae_bingo,代码行数:12,代码来源:__init__.py

示例3: flush_hippo_counts_memcache

    def flush_hippo_counts_memcache(self):
        experiments, alternative_lists = BingoCache.get().experiments_and_alternatives_from_canonical_name("hippos")

        for experiment in experiments:
            experiment.reset_counters()

        return True
开发者ID:dguiley,项目名称:gae_bingo,代码行数:7,代码来源:run_step.py

示例4: count_conversions_in

    def count_conversions_in(self):
        dict_conversions = {}

        for alternative in BingoCache.get().get_alternatives(self.request.get("experiment_name")):
            dict_conversions[alternative.content] = alternative.latest_conversions_count()

        return dict_conversions
开发者ID:dguiley,项目名称:gae_bingo,代码行数:7,代码来源:run_step.py

示例5: participate_in_doppleganger_on_new_instance

    def participate_in_doppleganger_on_new_instance(self):
        """Simulate participating in a new experiment on a "new" instance.
        
        This test works by loading memcache with a copy of all gae/bingo
        experiments before the doppleganger test exists.

        After the doppleganger test has been created once, all future calls to
        this function simulate being run on machines that haven't yet cleared
        their instance cache and loaded the newly created doppleganger yet. We
        do this by replacing the instance cache'd state of BingoCache with the
        deep copy that we made before doppleganger was created.

        A correctly functioning test will still only create one copy of the
        experiment even though multiple clients attempted to create a new
        experiment.
        """
        # First, make a deep copy of the current state of bingo's experiments
        bingo_clone = memcache.get("bingo_clone")

        if not bingo_clone:
            # Set the clone by copying the current bingo cache state
            memcache.set("bingo_clone", copy.deepcopy(BingoCache.get()))
        else:
            # Set the current bingo cache state to the cloned state
            gae_bingo.instance_cache.set(BingoCache.CACHE_KEY, bingo_clone)

        return ab_test("doppleganger")
开发者ID:dguiley,项目名称:gae_bingo,代码行数:27,代码来源:run_step.py

示例6: delete_all_experiments

    def delete_all_experiments(self):
        bingo_cache = BingoCache.get()
        
        for experiment_name in bingo_cache.experiments.keys():
            bingo_cache.delete_experiment_and_alternatives(bingo_cache.get_experiment(experiment_name))

        return len(bingo_cache.experiments)
开发者ID:PaulWagener,项目名称:khan-website,代码行数:7,代码来源:__init__.py

示例7: count_participants_in

 def count_participants_in(self):
     return sum(
         map(
             lambda alternative: alternative.latest_participants_count(),
             BingoCache.get().get_alternatives(self.request.get("experiment_name")),
         )
     )
开发者ID:humble,项目名称:gae_bingo,代码行数:7,代码来源:__init__.py

示例8: flush_hippo_counts_memcache

    def flush_hippo_counts_memcache(self):
        experiments, alternative_lists = BingoCache.get().experiments_and_alternatives_from_canonical_name("hippos")

        for alternatives in alternative_lists:
            for alternative in alternatives:
                memcache.delete("%s:conversions" % alternative.key_for_self())
                memcache.delete("%s:participants" % alternative.key_for_self())

        return True
开发者ID:PaulWagener,项目名称:khan-website,代码行数:9,代码来源:__init__.py

示例9: count_experiments

 def count_experiments(self):
     return len(BingoCache.get().experiments)
开发者ID:dguiley,项目名称:gae_bingo,代码行数:2,代码来源:run_step.py

示例10: end_and_choose

 def end_and_choose(self):
     with ExperimentController() as dummy:
         bingo_cache = BingoCache.get()
         choose_alternative(
                 self.request.get("canonical_name"),
                 int(self.request.get("alternative_number")))
开发者ID:dguiley,项目名称:gae_bingo,代码行数:6,代码来源:run_step.py

示例11: try_this_bad

 def try_this_bad(self):
     cache = BingoCache.get()
     return len(cache.get_experiment_names_by_canonical_name("hippos"))
开发者ID:dguiley,项目名称:gae_bingo,代码行数:3,代码来源:run_step.py

示例12: archive_monkeys

 def archive_monkeys(self):
     bingo_cache = BingoCache.get()
     bingo_cache.archive_experiment_and_alternatives(bingo_cache.get_experiment("monkeys"))
     return True
开发者ID:dguiley,项目名称:gae_bingo,代码行数:4,代码来源:run_step.py

示例13: persist

 def persist(self):
     BingoCache.get().persist_to_datastore()
     BingoIdentityCache.persist_buckets_to_datastore()
     return True
开发者ID:PaulWagener,项目名称:khan-website,代码行数:4,代码来源:__init__.py

示例14: end_and_choose

 def end_and_choose(self):
     bingo_cache = BingoCache.get()
     choose_alternative(self.request.get("canonical_name"), int(self.request.get("alternative_number")))
开发者ID:PaulWagener,项目名称:khan-website,代码行数:3,代码来源:__init__.py

示例15: get_experiments

 def get_experiments(self):
     return str(BingoCache.get().experiments)
开发者ID:Hao-Hsuan,项目名称:KhanLatest,代码行数:2,代码来源:__init__.py


注:本文中的gae_bingo.cache.BingoCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。