本文整理汇总了Python中synapse.util.caches.stream_change_cache.StreamChangeCache.get_max_pos_of_last_change方法的典型用法代码示例。如果您正苦于以下问题:Python StreamChangeCache.get_max_pos_of_last_change方法的具体用法?Python StreamChangeCache.get_max_pos_of_last_change怎么用?Python StreamChangeCache.get_max_pos_of_last_change使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类synapse.util.caches.stream_change_cache.StreamChangeCache
的用法示例。
在下文中一共展示了StreamChangeCache.get_max_pos_of_last_change方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_max_pos
# 需要导入模块: from synapse.util.caches.stream_change_cache import StreamChangeCache [as 别名]
# 或者: from synapse.util.caches.stream_change_cache.StreamChangeCache import get_max_pos_of_last_change [as 别名]
def test_max_pos(self):
"""
StreamChangeCache.get_max_pos_of_last_change will return the most
recent point where the entity could have changed. If the entity is not
known, the stream start is provided instead.
"""
cache = StreamChangeCache("#test", 1)
cache.entity_has_changed("[email protected]", 2)
cache.entity_has_changed("[email protected]", 3)
cache.entity_has_changed("[email protected]", 4)
# Known entities will return the point where they were changed.
self.assertEqual(cache.get_max_pos_of_last_change("[email protected]"), 2)
self.assertEqual(cache.get_max_pos_of_last_change("[email protected]"), 3)
self.assertEqual(cache.get_max_pos_of_last_change("[email protected]"), 4)
# Unknown entities will return the stream start position.
self.assertEqual(cache.get_max_pos_of_last_change("[email protected]"), 1)