示例#1
0
 public void Set(object model, string fullKey = null, CacheOptions options = null)
 {
     if (fullKey == null)
     {
         fullKey = ModelKey(model);
     }
     this[fullKey, options] = model.ToJson();
 }
示例#2
0
        public string this[string key, CacheOptions options = null]
        {
            get
            {
                if (OperationalStatus != EOperationalStatus.Operational)
                {
                    return(null);
                }

                try
                {
                    return(GetNative(key));
                }
                catch (Exception e)
                {
                    Current.Log.Add(e);
                    return(null);
                }
            }
            set
            {
                if (OperationalStatus != EOperationalStatus.Operational)
                {
                    return;
                }

                try
                {
                    if (value != null)
                    {
                        SetNative(key, value, options);
                    }
                    else if (Contains(key))
                    {
                        Remove(key);
                    }
                }
                catch (Exception e)
                {
                    Current.Log.Add(e);
                }
            }
        }
示例#3
0
 public abstract void SetNative(string key, string serializedModel, CacheOptions options = null);