Beispiel #1
0
 /// <summary>
 ///  清空当前radis数据库中的所有键
 /// </summary>
 public void FlushDb()
 {
     RadisManager.GetClient().FlushDb();
 }
Beispiel #2
0
 /// <summary>
 /// 获取radis值
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="key">键</param>
 /// <returns></returns>
 public T Get <T>(string key)
 {
     return(RadisManager.GetClient().Get <T>(key));
 }
Beispiel #3
0
 /// <summary>
 /// 添加Radis(时间间隔)
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 /// <param name="expiresIn">时间间隔</param>
 /// <returns></returns>
 public bool Add <T>(string key, T value, TimeSpan expiresIn)
 {
     return(RadisManager.GetClient().Add <T>(key, value, expiresIn));
 }
Beispiel #4
0
 /// <summary>
 /// 数字递减存储键值
 /// </summary>
 /// <param name="key">键</param>
 /// <param name="amount">整数</param>
 /// <returns></returns>
 public long Decrement(string key, uint amount)
 {
     return(RadisManager.GetClient().Decrement(key, amount));
 }
Beispiel #5
0
 /// <summary>
 /// 添加Radis
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 /// <returns></returns>
 public bool Add <T>(string key, T value)
 {
     return(RadisManager.GetClient().Add <T>(key, value));
 }
Beispiel #6
0
 /// <summary>
 /// 添加Radis(过期时间)
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 /// <param name="expiresAt">过期时间</param>
 /// <returns></returns>
 public bool Add <T>(string key, T value, DateTime expiresAt)
 {
     return(RadisManager.GetClient().Add <T>(key, value, expiresAt));
 }
Beispiel #7
0
 /// <summary>
 /// 根据传入的多个key覆盖多条记录
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="values">值</param>
 public void SetAll <T>(IDictionary <string, T> values)
 {
     RadisManager.GetClient().SetAll <T>(values);
 }
Beispiel #8
0
 public void Dispose()
 {
     RadisManager.GetClient().Dispose();
 }
Beispiel #9
0
 /// <summary>
 /// 根据传入的key覆盖一条记录的值,当key不存在不会添加
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 /// <returns></returns>
 public bool Replace <T>(string key, T value)
 {
     return(RadisManager.GetClient().Replace <T>(key, value));
 }
Beispiel #10
0
 /// <summary>
 /// 删除多个键值
 /// </summary>
 /// <param name="keys">键</param>
 public void RemoveAll(IEnumerable <string> keys)
 {
     RadisManager.GetClient().RemoveAll(keys);
 }
Beispiel #11
0
 //传入数据库索引构造
 public Radis(long DefaultDb)
 {
     RadisManager.DefaultDb = DefaultDb;
     RadisManager.ReInitializeRedisPool();
 }
Beispiel #12
0
 /// <summary>
 /// 更具键删除键值
 /// </summary>
 /// <param name="key">键</param>
 /// <returns></returns>
 public bool Remove(string key)
 {
     return(RadisManager.GetClient().Remove(key));
 }
Beispiel #13
0
 /// <summary>
 /// 根据传入的多个key获取多条记录的值
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="keys">多个键</param>
 /// <returns></returns>
 public IDictionary <string, T> GetAll <T>(IEnumerable <string> keys)
 {
     return(RadisManager.GetClient().GetAll <T>(keys));
 }