![@lru_cache metrics.png](https://gist.github.com/ddebrunner/b24f0adffd5a66f5302eff8ad9ea3276/raw/10418ba839ad45509ff9b6bd969ef3dfc9815957/@lru_cache%2520metrics.png)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
# Example taken from: https://docs.python.org/3/library/functools.html#functools.lru_cache | |
# | |
# With this example the cache will be Python VM wide, thus if | |
# multiple map(fibs.fib) were invoked in the topology they | |
# wouldbe sharing the same cache. | |
@lru_cache() | |
def fib(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from streamsx.topology.topology import Topology | |
import streamsx.topology.context | |
from sseclient import SSEClient | |
class SSEReader(object): | |
""" | |
Read Server-sent events. | |
Includes checkpointing/consistent region support | |
so that recovery from a checkpoint starts at the last |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.Serializable; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Objects; | |
import java.util.Random; | |
import java.util.function.Supplier; |