```python:inference/core/managers/decorators/fixed_size_cache.py
from collections import deque
from inference.core import logger
from inference.core.env import MEMORY_FREE_THRESHOLD, USE_INFERENCE_MODELS
from inference.core.managers.base import ModelManager
from inference.core.managers.decorators.base import ModelManagerDecorator
from threading import Lock

# Move torch import to module level to avoid repeated import overhead
try:
    import torch
    _CUDA_AVAILABLE = torch.cuda.is_available()
except ImportError:
    _CUDA_AVAILABLE = False

class WithFixedSizeCache(ModelManagerDecorator):
    def __init__(self, model_manager: ModelManager, max_size: int = 8):
        """Cache decorator, models will be evicted based on the last utilization (`.infer` call). Internally, a [double-ended queue](https://docs.python.org/3/library/collections.html#collections.deque) is used to keep track of model utilization.

        Args:
            model_manager (ModelManager): Instance of a ModelManager.
            max_size (int, optional): Max number of models at the same time. Defaults to 8.
        """
        super().__init__(model_manager)
        self.max_size = max_size
        self._key_queue = deque(self.model_manager.keys())
        self._queue_lock = Lock()

    def memory_pressure_detected(self) -> bool:
        if not _CUDA_AVAILABLE:
            return False
        
        return_boolean = False
        try:
            free_memory, total_memory = torch.cuda.mem_get_info()
            return_boolean = (
                float(free_memory / total_memory) < MEMORY_FREE_THRESHOLD
            )
            if return_boolean and USE_INFERENCE_MODELS:
                # we only enable this under condition that USE_INFERENCE_MODELS is True
                # and we are about to remove a model
                # just to make sure we are not flapping around the threshold for no reason
                torch.cuda.empty_cache()
                free_memory, total_memory = torch.cuda.mem_get_info()
                return_boolean = (
                    float(free_memory / total_memory) < MEMORY_FREE_THRESHOLD
                )
            logger.debug(
                f"Free memory: {free_memory}, Total memory: {total_memory}, threshold: {MEMORY_FREE_THRESHOLD}, return_boolean: {return_boolean}"
            )
            # TODO: Add memory calculation for other non-CUDA devices
        except Exception as e:
            logger.error(
                f"Failed to check CUDA memory pressure: {e}, returning {return_boolean}"
            )
        return return_boolean
```