Esempio n. 1
0
        public Cache(Kernel kernel, Logger logger, Conf conf)
            : base(logger)
        {
            this.logger = logger;
            //_oneOption = oneOption;
            _conf = conf;
            _useCache = (bool)conf.Get("useCache");

            if (!_useCache)
                return;

            _expires = (int)conf.Get("expires");
            _maxSize = (int)conf.Get("maxSize");
            _diskSize = (int)conf.Get("diskSize");
            _memorySize = (int)conf.Get("memorySize");

            //�L���b�V���Ώۃ��X�g
            _cacheTargetHost = new CacheTarget((Dat)conf.Get("cacheHost"), (int)conf.Get("enableHost"));
            _cacheTargetExt = new CacheTarget((Dat)conf.Get("cacheExt"), (int)conf.Get("enableExt"));

            //�f�B�X�N�L���b�V��
            var cacheDir = (string)conf.Get("cacheDir");//�L���b�V����ۑ�����f�B���N�g��
            if (cacheDir == "" || !Directory.Exists(cacheDir)) {
                logger.Set(LogKind.Error, null, 15, string.Format("dir = {0}", cacheDir));
                _diskSize = 0;
            }
            if (_diskSize != 0) {
                _diskCache = new DiskCache(cacheDir, logger);
            }

            if (_memorySize != 0)//�������L���b�V��
                _memoryCache = new MemoryCache(logger);
        }
Esempio n. 2
0
        bool _cacheRefresh;//�L���b�V�����|

        public Cache(Kernel kernel, Logger logger, Conf conf)
            : base(logger)
        {
            this.logger = logger;
            //_oneOption = oneOption;
            _conf     = conf;
            _useCache = (bool)conf.Get("useCache");

            if (!_useCache)
            {
                return;
            }

            _expires    = (int)conf.Get("expires");
            _maxSize    = (int)conf.Get("maxSize");
            _diskSize   = (int)conf.Get("diskSize");
            _memorySize = (int)conf.Get("memorySize");


            //�L���b�V���Ώۃ��X�g
            _cacheTargetHost = new CacheTarget((Dat)conf.Get("cacheHost"), (int)conf.Get("enableHost"));
            _cacheTargetExt  = new CacheTarget((Dat)conf.Get("cacheExt"), (int)conf.Get("enableExt"));

            //�f�B�X�N�L���b�V��
            var cacheDir = (string)conf.Get("cacheDir");//�L���b�V����ۑ�����f�B���N�g��

            if (cacheDir == "" || !Directory.Exists(cacheDir))
            {
                logger.Set(LogKind.Error, null, 15, string.Format("dir = {0}", cacheDir));
                _diskSize = 0;
            }
            if (_diskSize != 0)
            {
                _diskCache = new DiskCache(cacheDir, logger);
            }

            if (_memorySize != 0)//�������L���b�V��
            {
                _memoryCache = new MemoryCache(logger);
            }
        }