Example #1
0
        /// <inheritdoc/>
        public T Get <T>(CoreCachingKey key)
        {
            ThrowExceptionIfFaulty();

            T result = default;

            if (IsEnabled && !GlobalStorageHelper.IsFaulty)
            {
                result = LocalStorageService.GetData <T>(key);

                if (result != null)
                {
                    return(result);
                }

                if (GlobalStorageService != null)
                {
                    result = GlobalStorageService.GetData <T>(key);
                }
            }

            return(result);
        }
Example #2
0
        /// <inheritdoc/>
        public async Task <T> GetAsync <T>(CoreCachingKey key)
        {
            ThrowExceptionIfFaulty();

            T result = default;

            if (IsEnabled)
            {
                result = LocalStorageService.GetData <T>(key);

                if (result != null)
                {
                    return(result);
                }

                if (GlobalStorageService != null)
                {
                    result = await GlobalStorageService.GetDataAsync <T>(key).CoreBaseExtTaskWithCurrentCulture(false);
                }
            }

            return(result);
        }