Пример #1
0
 static Startup()
 {
     Startup.redis = StackExchange.Redis.ConnectionMultiplexer.Connect(new StackExchange.Redis.ConfigurationOptions()
     {
         EndPoints = { { "localhost", 6379 } }, Password = "******"
     });
 }
Пример #2
0
        public static void InitializeRedis(TestContext context)
        {
            var config = StackExchange.Redis.ConfigurationOptions.Parse("localhost");

            config.AllowAdmin = true;

            Redis = StackExchange.Redis.ConnectionMultiplexer.Connect(config);
        }
Пример #3
0
 public DBSeedFactory()
 {
     redisConn   = StackExchange.Redis.ConnectionMultiplexer.Connect("localhost");
     _connection = RelationalOptionsExtension.Extract(contextOptions).Connection;
     _connection.Open();
     _db = new ScreamBackend.DB.ScreamDB(contextOptions);
     SeedInit();
 }
        /// <summary>
        /// Obtenir du cache partagé
        /// </summary>
        /// <param name="DirectInvoiceid"></param>
        /// <returns></returns>
        public DirectInvoice GetDirectInvoice(string iddirectinvoice)
        {
            DirectInvoice retour = null;

            try
            {
                // Obtien d'abord l'objet sur MemCached si Existe
                if (env != null)
                {
                    StackExchange.Redis.ConfigurationOptions redisconfig = new StackExchange.Redis.ConfigurationOptions();
                    redisconfig.EndPoints.Add("22ec9a54-2921-43af-a4e9-9b1e7aff2b9b.pdb.ovh.net", 21784);
                    redisconfig.Password = "******";

                    StackExchange.Redis.ConnectionMultiplexer redis   = StackExchange.Redis.ConnectionMultiplexer.Connect(redisconfig);
                    StackExchange.Redis.IDatabase             redisDb = redis.GetDatabase();


                    StackExchange.Redis.RedisKey key = iddirectinvoice;

                    StackExchange.Redis.RedisValue val = redisDb.StringGet(key, StackExchange.Redis.CommandFlags.None);
                    if (!string.IsNullOrWhiteSpace(val))
                    {
                        retour = new DirectInvoice();
                        retour.FromStringData(val);
                    }
                }

                // sinon regarde en base
                if (retour == null)
                {
                    Dictionary <string, object> ins = new Dictionary <string, object>();
                    ins.Add("iddirectinvoice", iddirectinvoice);
                    retour = this.GetOneDefault <DirectInvoice>(ins);
                }
                return(retour);
            }
            catch (Exception ex)
            {
                throw new Exception("GetDirectInvoice " + ex.Message, ex);
            }
        }
        /// <summary>
        /// enregistre en base et dans le cache partagé
        /// </summary>
        public void SaveDirectInvoice(DirectInvoice directinvoice)
        {
            try
            {
                // Enregistrement des clef (données persistantes) en bases
                System.Data.DataRowState rowstate = directinvoice.GetRow().RowState;
                if (rowstate == System.Data.DataRowState.Detached || rowstate == System.Data.DataRowState.Added)
                {
                    this.InsertBubble(directinvoice, true, false);
                }
                else
                {
                    this.SaveBubble(directinvoice);
                }

                // Enregistrement des données non persistantes sur MemCached
                if (env != null)
                {
                    StackExchange.Redis.ConnectionMultiplexer redis   = StackExchange.Redis.ConnectionMultiplexer.Connect(GetRedisConfig());
                    StackExchange.Redis.IDatabase             redisDb = redis.GetDatabase();

                    StackExchange.Redis.RedisValue val = directinvoice.ToStringData();
                    StackExchange.Redis.RedisKey   key = directinvoice.IdDirectInvoice;
                    redisDb.StringSet(key, val, null, StackExchange.Redis.When.Always, StackExchange.Redis.CommandFlags.None);



                    // redng75Oj82p

                    // !!! stocker dans memecached
                }
            }
            catch (Exception ex)
            {
                throw new Exception("SaveDirectInvoice " + ex.Message, ex);
            }
        }
Пример #6
0
        public ACT1228EarthQuake(string id, string ip, string localIP, int port, Chart chart, string deviceType, string path, string database, TextBox tb, double threshold, StackExchange.Redis.ConnectionMultiplexer redis)
        {
            this.Tag     = ip + " : ";
            dataQueue    = new ConcurrentQueue <float[]>();
            uiQueue      = new ConcurrentQueue <float[]>();
            rawQueue     = new ConcurrentQueue <string>();
            historyQueue = new ConcurrentQueue <string>();
            Threshold    = threshold;
            backgroundWorkerProcessData = new BackgroundWorker();
            backgroundWorkerReceiveData = new BackgroundWorker();
            backgroundWorkerUpdateUI    = new BackgroundWorker();
            backgroundWorkerProcessData.WorkerSupportsCancellation = true;
            backgroundWorkerProcessData.DoWork += BackgroundWorkerProcessData_DoWork;

            backgroundWorkerUpdateUI.WorkerSupportsCancellation = true;
            backgroundWorkerUpdateUI.DoWork += BackgroundWorkerUpdateUI_DoWork;

            backgroundWorkerReceiveData.WorkerSupportsCancellation = true;
            backgroundWorkerReceiveData.DoWork += BackgroundWorkerReceiveData_DoWork;

            hourTimer             = new System.Timers.Timer(1000 * 60 * 60 * 1);
            hourTimer.Elapsed    += new System.Timers.ElapsedEventHandler(HourTimer_TimesUp);
            hourTimer.AutoReset   = true; //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true)
            minuteTimer           = new System.Timers.Timer(1000 * 60 * 2);
            minuteTimer.Elapsed  += new System.Timers.ElapsedEventHandler(MinuteTimer_TimesUp);
            minuteTimer.AutoReset = false; //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true)

            window = RaisedCosineWindow.Hann(WindowSize);

            this.ip              = ip;
            this.localIP         = localIP;
            this.deviceId        = id;
            this.deviceType      = deviceType;
            this.udpPort         = port;
            this.chart1          = chart;
            this.basePath        = path;
            this.database        = database;
            this.isUpdateChart   = false;
            this.vibrateChannels = new Dictionary <int, VibrateChannel>();

            this.Threshold = threshold;

            LoadChannels();
        }
Пример #7
0
 private RedisUtils()
 {
     _conn = StackExchange.Redis.ConnectionMultiplexer.Connect(BuildRedisConfiguration());
 }
Пример #8
0
 public DownloadUpdateService(StackExchange.Redis.ConnectionMultiplexer redis, string redisDownloadListKey)
 {
     this.redis = redis;
     this.redisDownloadListKey = redisDownloadListKey;
 }