from collections import deque
class FrameCache:
def __init__(self,capacity=600): # 600 is enough for 10 min of 1 fps
self._capacity=capacity
self._cache=deque()
def put(self,frame):
if len(self._cache)>=self._capacity:
self._cache.popleft()
self._cache.append(frame)