MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / keep

Method keep

ui/easydiffusion/task_manager.py:119–129  ·  view source on GitHub ↗
(self, key: Hashable, ttl: int)

Source from the content-addressed store, hash-verified

117 self._lock.release()
118
119 def keep(self, key: Hashable, ttl: int) -> bool:
120 if not self._lock.acquire(blocking=True, timeout=LOCK_TIMEOUT):
121 raise Exception("DataCache.keep" + ERR_LOCK_FAILED)
122 try:
123 if key in self._base:
124 _, value = self._base.get(key)
125 self._base[key] = (self._get_ttl_time(ttl), value)
126 return True
127 return False
128 finally:
129 self._lock.release()
130
131 def put(self, key: Hashable, value: Any, ttl: int) -> bool:
132 if not self._lock.acquire(blocking=True, timeout=LOCK_TIMEOUT):

Callers 3

keep_task_aliveFunction · 0.80
get_cached_taskFunction · 0.80
get_cached_sessionFunction · 0.80

Calls 2

_get_ttl_timeMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected