added CachedSource mixin
This commit is contained in:
18
kabuki/sources/cachedsource.py
Normal file
18
kabuki/sources/cachedsource.py
Normal 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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user