added CachedSource mixin

This commit is contained in:
2021-06-05 15:35:26 +02:00
parent 3a96109354
commit 508290c998

View File

@ -0,0 +1,18 @@
from ..cacher import Cache
class CachedSource:
def __init__(self, size=1):
self.cache = cache = Cache(size=size)
self.cb = self.add_callback(cache.callback_append)
def disconnect(self):
self.remove_callback(self._cb)
#TODO: check if source is connected before adding callback