refactor: migrate native modules from bauh/ to bearhub/ (test batch)

This commit is contained in:
Sebastian
2026-06-27 10:06:05 +02:00
parent 002b5c839e
commit c56b8a2473
2 changed files with 51 additions and 0 deletions

1
.gitignore vendored
View File

@@ -22,3 +22,4 @@ AGENTS.md
packaging/aur/**/*.tar.gz packaging/aur/**/*.tar.gz
packaging/aur/**/src packaging/aur/**/src
packaging/aur/**/pkg packaging/aur/**/pkg

View File

@@ -0,0 +1,50 @@
from abc import ABC, abstractmethod
from typing import Set, Optional
class MemoryCache(ABC):
"""
Represents a memory cache.
"""
@abstractmethod
def is_enabled(self):
pass
@abstractmethod
def add(self, key: str, val: object):
pass
@abstractmethod
def add_non_existing(self, key: str, val: object):
pass
@abstractmethod
def get(self, key: str):
pass
@abstractmethod
def delete(self, key):
pass
@abstractmethod
def keys(self) -> Set[str]:
pass
@abstractmethod
def clean_expired(self):
pass
class MemoryCacheFactory(ABC):
"""
Instantiate new memory cache instances.
"""
@abstractmethod
def new(self, expiration: Optional[int]) -> MemoryCache:
"""
:param expiration: expiration time for the cache keys in seconds. Use -1 to disable this feature.
:return:
"""
pass