示例#1
0
 //
 // 摘要:
 //     按名称获取或设置会话值。
 //
 // 参数:
 //   name:
 //     会话值的键名。
 //
 // 返回结果:
 //     具有指定名称的会话状态值;如果该项不存在,则为 null。
 //public string this[string name]
 //{
 //    get
 //    {
 //        //return client.GetValueFromHash(SessionID, name);
 //        return RedisBase.Hash_Get<string>(SessionName, name);
 //    }
 //    set
 //    {
 //        //client.SetEntryInHash(SessionID, name, value);
 //        RedisBase.Hash_Set<string>(SessionName, name, value);
 //    }
 //}
 public object this[string name]
 {
     get
     {
         //return client.GetValueFromHash(SessionID, name);
         return(RedisBase.Hash_Get <object>(SessionName, name));
     }
     set
     {
         //client.SetEntryInHash(SessionID, name, value);
         RedisBase.Hash_Set <object>(SessionName, name, value);
     }
 }
示例#2
0
 //
 // 摘要:
 //     向会话状态集合添加一个新项。
 //
 // 参数:
 //   name:
 //     要添加到会话状态集合的项的名称。
 //
 //   value:
 //     要添加到会话状态集合的项的值。
 public void Add <T>(string name, T value)
 {
     //client.SetEntryInHash(SessionID, name, value);
     RedisBase.Hash_Set <T>(SessionName, name, value);
 }