Skip to content

Commit c553e74

Browse files
committed
changed @lru_cache to cache since, in this case, they behave the same way
1 parent 114564b commit c553e74

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/dependencies.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from functools import lru_cache
1+
from functools import cache
22
from typing import Annotated
33

44
from fastapi import Depends
@@ -8,21 +8,21 @@
88
from src.controllers.environment import EnvironmentController
99
from src.controllers.flight import FlightController
1010

11-
@lru_cache(maxsize=1)
11+
@cache
1212
def 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)
2626
def 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
3737
def 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
4848
def get_flight_controller() -> FlightController:
4949
"""
5050
Provides a singleton FlightController instance.

0 commit comments

Comments
 (0)