Exemple #1
0
        public override bool AddData(string key, object data, TimeSpan?span = null)
        {
            if (data == null || key == null)
            {
                return(false);
            }
            if (!DataChanged.ContainsKey(key))
            {
                DataChanged.Add(key, false);
            }
            else
            {
                DataChanged[key] = false;
            }
            //
            Action act;

            if (span == null)
            {
                act = () => _cache.Set(key, data);
            }
            else
            {
                act = () => _cache.Set(key, data, (System.TimeSpan)span);
            }
            Task task = new Task(act);

            task.Start();
            return(true);
        }