aboutsummaryrefslogtreecommitdiff
path: root/src/Cache.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-08 12:20:08 +0100
committerGravatar jesopo2019-10-08 12:20:08 +0100
commit4c02c7c86ab5bfd522947155ed2b558b6f5c510e (patch)
treecd7a7423b90a87d253088755d0d5d33f9b7b2f75 /src/Cache.py
parentonly show youtu.be url when one was not provided (diff)
signature
refactor anything that effects event poll timeout in to PollHook objects
Diffstat (limited to 'src/Cache.py')
-rw-r--r--src/Cache.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Cache.py b/src/Cache.py
index 09c0230f..f28a0952 100644
--- a/src/Cache.py
+++ b/src/Cache.py
@@ -1,6 +1,7 @@
import hashlib, time, typing, uuid
+from src import PollHook
-class Cache(object):
+class Cache(PollHook.PollHook):
def __init__(self):
self._items = {}
@@ -21,7 +22,7 @@ class Cache(object):
self._items[id] = [key, value, expiration]
return id
- def next_expiration(self) -> typing.Optional[float]:
+ def next(self) -> typing.Optional[float]:
if not self._cached_expiration == None:
return self._cached_expiration
@@ -36,7 +37,7 @@ class Cache(object):
self._cached_expiration = expiration
return expiration
- def expire(self):
+ def call(self):
now = time.monotonic()
expired = []
for id in self._items.keys():