File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from functools import lru_cache
1+ from functools import cache
22from typing import Annotated
33
44from fastapi import Depends
88from src .controllers .environment import EnvironmentController
99from src .controllers .flight import FlightController
1010
11- @lru_cache ( maxsize = 1 )
11+ @cache
1212def get_rocket_controller () -> RocketController :
1313 """
1414 Provides a singleton RocketController instance.
1515
1616 The controller is stateless and can be safely reused across requests.
17- Using lru_cache ensures thread-safe singleton behavior.
17+ Using cache ensures thread-safe singleton behavior.
1818
1919 Returns:
2020 RocketController: Shared controller instance for rocket operations.
2121 """
2222 return RocketController ()
2323
2424
25- @lru_cache (maxsize = 1 )
25+ @cache (maxsize = 1 )
2626def get_motor_controller () -> MotorController :
2727 """
2828 Provides a singleton MotorController instance.
@@ -33,7 +33,7 @@ def get_motor_controller() -> MotorController:
3333 return MotorController ()
3434
3535
36- @lru_cache ( maxsize = 1 )
36+ @cache
3737def get_environment_controller () -> EnvironmentController :
3838 """
3939 Provides a singleton EnvironmentController instance.
@@ -44,7 +44,7 @@ def get_environment_controller() -> EnvironmentController:
4444 return EnvironmentController ()
4545
4646
47- @lru_cache ( maxsize = 1 )
47+ @cache
4848def get_flight_controller () -> FlightController :
4949 """
5050 Provides a singleton FlightController instance.
You can’t perform that action at this time.
0 commit comments