Exemplo n.º 1
0
        static void Main(string[] args)
        {
            logger = NLog.LogManager.GetCurrentClassLogger();
            System.Reflection.Assembly executeAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            DateTime lastBuildDate =
                new System.IO.FileInfo(executeAssembly.Location).LastWriteTime;

            logger.Info($"CollectInstantaneous App Start. Last build:{lastBuildDate.ToShortDateString()} (utc)");

            try
            {
#if DEBUG
                string fileName = "redisconfig.Development.json";
#else
                string fileName = "redisconfig.json";
                timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Asia/Seoul");
#endif

                string             redis_config_full_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
                RedisConfiguration config = JsonConvert.DeserializeObject <RedisConfiguration>(File.ReadAllText(redis_config_full_path));
                influxDataAccess  = InfluxDataAccess.CreateDataAccessFromEnvironment();
                RedisDataAccessor = new RedisDataAccessor(config);
                redisDatabase     = RedisDataAccessor.GetDatabase();
                Task worker = Run();
                worker.Wait();
            }
            catch (Exception ex)
            {
                logger.Error(ex, ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Initializes a new instance of the <see cref="RedisDamageManager" /> class, which will allow us to interact with the cache.
        /// </summary>
        public RedisDamageManager()
        {
            // Create the Redis host, start it, and save the accessor.
            //  TODO: Connect to an existing one, if necessary.
            this.redisHost = new RedisHost();
            this.redisHost.Start();

            this.redisCache = this.redisHost.CreateAccessor();
        }
Exemplo n.º 3
0
        /// <summary>
        ///  Creates a data accessor for the current local Redis instance.
        /// </summary>
        /// <returns>A data access, configured to the current Redis instance.</returns>
        public RedisDataAccessor CreateAccessor()
        {
            // No instance, no DAO.
            if (this.currInstance == null)
            {
                return(null);
            }

            // Builds the accessor for the Redis instance.
            RedisDataAccessor newAccessor = new RedisDataAccessor();

            if (newAccessor.Initialize("localhost", InstanceParams.DefaultPortNumber))
            {
                return(newAccessor);
            }

            return(null);
        }