public IActionResult Index()
        {
            var patientInfoService = new PatientInfo();

            var patientList = new List <PatientInfo>();

            if (!memoryCache.TryGetValue("PatientInfoCache", out patientList))
            {
                if (patientList == null || !patientList.Any())
                {
                    patientList = patientInfoService.GetPatientInfos();
                }

                var cacheEntryOptions = new MemoryCacheEntryOptions();
                cacheEntryOptions.SetSlidingExpiration(TimeSpan.FromSeconds(7));

                // here we need to set the value for cache memory
                memoryCache.Set("PatientInfoCache", patientList, cacheEntryOptions);

                //to remove
                memoryCache.Remove("PatientInfoCache");
            }

            var model = new PatientListViewModel
            {
                PatientInfos = patientList
            };

            return(View(model));
        }