[#3] Added generate proto script create container method

Signed-off-by: Ilyas Niyazov <i.niyazov@yadro.com>
This commit is contained in:
Ilyas Niyazov 2025-03-13 14:26:01 +03:00
parent f8465e5b99
commit fba6eaaa9c
34 changed files with 547 additions and 108 deletions

View file

@ -0,0 +1,37 @@
from dataclasses import dataclass
@dataclass(frozen=True)
class SessionToken:
token: bytes
class SessionCache:
def __init__(self, session_expiration_duration):
self.cache = {}
self.token_duration = session_expiration_duration
self.current_epoch = 0
def contains(self, key):
return key in self.cache
def try_get_value(self, key):
if not key:
return None
return self.cache.get(key)
def set_value(self, key, value):
if key is not None:
self.cache[key] = value
def delete_by_prefix(self, prefix):
# Collect keys to avoid modifying dictionary during iteration
keys_to_delete = [key for key in self.cache if key.startswith(prefix)]
for key in keys_to_delete:
del self.cache[key]
@staticmethod
def form_cache_key(address: str, key: str):
return address + key