From 3966c5e047f195dc47c8985569d58cf2de1e8c32 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Sat, 1 Aug 2026 23:06:27 +0800 Subject: [PATCH] Retain persistent storage owners Signed-off-by: Loren Eteval --- Furious/Library/Storage.py | 52 ++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/Furious/Library/Storage.py b/Furious/Library/Storage.py index 2ccc4f11..ad5e4c07 100644 --- a/Furious/Library/Storage.py +++ b/Furious/Library/Storage.py @@ -36,6 +36,38 @@ __all__ = ['Storage'] class Storage: """Provide cached access to persisted user configuration collections.""" + @staticmethod + @functools.lru_cache(None) + def _UserServersStorage() -> UserServers: + """Return the application-lifetime user-server storage owner.""" + assert APP() is not None + + return UserServers() + + @staticmethod + @functools.lru_cache(None) + def _UserSubsStorage() -> UserSubs: + """Return the application-lifetime subscription storage owner.""" + assert APP() is not None + + return UserSubs() + + @staticmethod + @functools.lru_cache(None) + def _UserTUNSettingsStorage() -> UserTUNSettings: + """Return the application-lifetime TUN-settings storage owner.""" + assert APP() is not None + + return UserTUNSettings() + + @staticmethod + @functools.lru_cache(None) + def _UserRoutingsStorage() -> UserRoutings: + """Return the application-lifetime custom-routing storage owner.""" + assert APP() is not None + + return UserRoutings() + @staticmethod def UserActivatedItemIndex() -> int: """Return the user activated item index value.""" @@ -47,36 +79,24 @@ class Storage: return -1 @staticmethod - @functools.lru_cache(None) def UserServers() -> list[ConfigFactory]: """Return the user servers value.""" - assert APP() is not None - - return UserServers().data() + return Storage._UserServersStorage().data() @staticmethod - @functools.lru_cache(None) def UserSubs() -> dict[str, dict]: """Return the user subs value.""" - assert APP() is not None - - return UserSubs().data() + return Storage._UserSubsStorage().data() @staticmethod - @functools.lru_cache(None) def UserTUNSettings() -> dict[str, str]: """Return the user TUN settings value.""" - assert APP() is not None - - return UserTUNSettings().data() + return Storage._UserTUNSettingsStorage().data() @staticmethod - @functools.lru_cache(None) def UserRoutings() -> dict[str, dict]: """Return the user routings value.""" - assert APP() is not None - - return UserRoutings().data() + return Storage._UserRoutingsStorage().data() class Extras: """Derive display and proxy values from the active server."""