c # – Caching search values ​​in an ecommerce website

I am working on a Web application (ASP.NET MVC). I have a CarMake drop-down list in my application: it contains the car names and the corresponding identifier, for example: {1: Alfa romeo}, {2: Audi}, {3: BMW}, etc.

I want to keep this search in the cache so that I do not have to go to the database every time I want to get the name or the corresponding ID …

So, in my infrastructure layer, I read the data from the database and cache it. I'm using a static class CarMakeLookup:

public static class CarMakeLookup
{
    private static readonly Dictionary _carMakeIdLookup;
    private static readonly Dictionary _carMakeNameLookup;

    static CarMakeLookup()
    {
        _carMakeIdLookup = new Dictionary();
        _carMakeNameLookup = new Dictionary();

        using (var context = ApplicationDbContext.Create())
        {
            DropdownRepository dropdownRepository = new DropdownRepository(context);

            var carMakes = dropdownRepository.GetCarMakes();
            foreach (var carMake in carMakes)
            {
                _carMakeIdLookup(carMake.CarMakeId) = carMake.CarMakeName;
                _carMakeNameLookup(carMake.CarMakeName.ToLower()) = carMake.CarMakeId;
            }
        }
    }

    public static string GetCarMakeName(short carMakeId)
    {
        if (carMakeId <= 0)
        {
            return string.Empty;
        }

        if (_carMakeIdLookup.ContainsKey(carMakeId))
        {
            return _carMakeIdLookup(carMakeId);
        }

        return string.Empty;
    }

    public static short GetCarMakeId(string carMakeName)
    {
        if (!string.IsNullOrEmpty(carMakeName))
        {
            string lowerCaseCarMakeName = carMakeName.ToLower();
            if (_carMakeNameLookup.ContainsKey(lowerCaseCarMakeName))
            {
                return _carMakeNameLookup(lowerCaseCarMakeName);
            }
        }

        return -1;
    }

    public static Dictionary GetCarMakeLookup()
    {
        return _carMakeIdLookup;
    }
}

I also need to display the car in a drop-down menu in my view … so I need one. List be displayed as a drop-down list. So, in my Application layer, I have another static class that contains this list:

public static class CarCache
{
    static CarCache()
    {
        var selectCarMake = new SelectListItem { Value = "-1", Text = "Select a car", Disabled = true, Selected = true };
        CarMakeItemsIncludingSelect = new List(); // Dropdown's first option should be "select a car"
        CarMakeItemsIncludingSelect.Insert(0, selectCarMake);

        foreach (KeyValuePair carMakeKeyPair in CarMakeLookup.GetCarMakeLookup())
        {
            var selectListItem = new SelectListItem { Value = carMakeKeyPair.Key.ToString(), Text = carMakeKeyPair.Value };
            CarMakeItemsIncludingSelect.Add(selectListItem);
        }
    }

    public static List CarMakeItemsIncludingSelect { get; private set; }

    public static string GetCarMakeName(short carMakeId)
    {
        return CarMakeLookup.GetCarMakeName(carMakeId);
    }

    public static short GetCarMakeId(string carMakeName)
    {
        return CarMakeLookup.GetCarMakeId(carMakeName);
    }
}

I have some other dropdown lists like this one in my application, for example HouseType, JobType, etc.

Everything works fine, the only problem is that the startup time of my application is slow … I guess only one problem is that when I start to debug the application, the application starts to create all these static cache classes and, since these classes are static, I can not inject. the DbContext in them … so each drop-down should build its own DdContext For example, obtain the corresponding data from DB and Dispose of. DbContext. There is no performance problem with the production server …

Any recommendations on how to improve this cache?