public void Initialize()
        {
            ConnectionDto connectionDto = new ConnectionDto(
                this.Session.Connection.Name,
                this.Session.Connection.HostName,
                this.Session.Connection.Port);

            SlabsDto slabContainer = this.cacheService.GetSlabs(connectionDto);
        }
Exemple #2
0
        public SlabsDto GetSlabs(ConnectionDto connection)
        {
            SlabsDto slabs = null;

            Cache cache = new Cache(connection);

            cache.Connect();
            slabs = cache.GetSlabs();
            cache.Disconnect();

            return(slabs);
        }
Exemple #3
0
        public SlabsDto GetSlabs()
        {
            SlabsDto slabsContainer = null;

            this.EnsureConnected();

            string response = string.Empty;

            response = this.ExecuteCommand(Cache.Commands.SlabsStatistics);
            SlabsStatisticsParserCommand statsCommand = new SlabsStatisticsParserCommand(response);

            statsCommand.Parse();
            SlabsDto slabsStatsContainer = statsCommand.SlabContainer;

            response = this.ExecuteCommand(Cache.Commands.ItemsStatistics);
            SlabContentParserCommand contentCommand = new SlabContentParserCommand(response);

            contentCommand.Parse();
            SlabsDto slabsContentContainer = contentCommand.SlabContainer;

            slabsContainer = new SlabsDto();
            slabsContainer.ActiveSlabCount      = slabsStatsContainer.ActiveSlabCount;
            slabsContainer.TotalMemoryAllocated = slabsStatsContainer.TotalMemoryAllocated;

            foreach (SlabDto statSlab in slabsStatsContainer.Slabs)
            {
                foreach (SlabDto contentSlab in slabsContentContainer.Slabs)
                {
                    if (statSlab.ID == contentSlab.ID)
                    {
                        SlabDto slab = new SlabDto();

                        slab.ID         = statSlab.ID;
                        slab.Statistics = statSlab.Statistics;
                        slab.Contents   = contentSlab.Contents;

                        slabsContainer.Slabs.Add(slab);

                        break;
                    }
                }
            }

            return(slabsContainer);
        }
 public SlabContentParserCommand(string content) : base(content)
 {
     this.SlabContainer = new SlabsDto();
 }