예제 #1
0
        public List <Category> GetAll()
        {
            ////önce git cache e bak diycez.
            //if (_cacheService.IsExist("unique_key"))
            //    return _cacheService.Get<List<Category>>("unique_key");

            //var data = _categoryDal.GetAll();
            //_cacheService.Add("unique_key", data);

            //return data;

            return(_cacheService.Cache("unique_key", () => _categoryDal.GetAll()));
        }
예제 #2
0
        private async Task <bool> TootTheFeedEntry(FeedEntry entry, bool populateCacheOnly, Feed feed)
        {
            // Toot if wanted
            if (!populateCacheOnly)
            {
                var tootResult = await instance.TootFeedEntry(entry, feed?.Toot?.Template, feed?.Toot?.Visibiliy);

                if (!tootResult)
                {
                    return(false);
                }
            }

            // Cache the entry
            await cache.Cache(feed.Name, entry.Id, entry.Published.DateTime);

            return(true);
        }
예제 #3
0
        public async Task OpenDatabase()
        {
            var database = await OpenFileAsync();

            using (var fs = await database.OpenReadAsync())
            {
                // TODO: handle errors & display transformation progress
                var result = await FileFormat.Headers(fs);

                var headers = result.Headers;

                var masterKey = await _password
                                .GetMasterKey(headers);

                using (var decrypted = await FileFormat
                                       .Decrypt(fs, masterKey, headers))
                {
                    // TODO: verify start bytes
                    await FileFormat.VerifyStartBytes(
                        decrypted, headers);

                    // Parse content
                    var doc = await FileFormat.ParseContent(
                        decrypted, headers.UseGZip, headers);

                    // TODO: verify headers integrity

                    _cache.Cache(new CachedDatabase
                    {
                        Id       = Id,
                        Document = doc,
                        Name     = DisplayName,
                        Headers  = headers,
                    });

                    _navigation
                    .UriFor <GroupViewModel>()
                    .Navigate();

                    _navigation.BackStack.Remove(
                        _navigation.BackStack.Last());
                }
            }
        }
예제 #4
0
        public ActionResult Index()
        {
            var doctorSection = _cacheService.Cache(
                () => _doctorSectionRepository
                .GetDoctorSection(),                                                       // Gets data for the DoctorSection if there isn't any cached data (data was invalidated or cache expired)
                60,                                                                        // Sets caching of data to 60 minutes
                $"{nameof(DoctorsController)}|{nameof(Index)}|{nameof(DoctorSectionDto)}", // cached data identifier
                _cacheService.GetNodesCacheDependencyKey(Doctor.CLASS_NAME,
                                                         CacheDependencyType.All)          // cache dependencies
                );

            if (doctorSection == null)
            {
                return(HttpNotFound());
            }

            var model = GetPageViewModel(new DoctorsViewModel
            {
                DoctorSection = doctorSection,
                Doctors       = _doctorsRepository.GetDoctors()
            }, doctorSection.Header);

            return(View(model));
        }
예제 #5
0
        [NoLog] //Bu method da log alma demek için. Bunun için NoLogAttribute class oluşturduk ve LogAspectAttribute class da On Entry de bir kod yazdık.
        public List <Product> GetAll()
        {
            //return _productDal.GetAll();

            return(_cacheService.Cache("unique_key2", () => _productDal.GetAll()));
        }