代码:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using ServiceStack.Redis;
  7. using System.Configuration;
  8. using ServiceStack.Redis.Generic;
  9. using Newtonsoft.Json;
  10.  
  11. namespace Rongzi.BZone.Common.Util
  12. {
  13. public class RedisCommon
  14. {
  15. private static readonly Lazy<RedisCommon> _instance = new Lazy<RedisCommon>(() => new RedisCommon());
  16. private static readonly string redisUrl = ConfigurationManager.AppSettings["Redis_Server"];
  17. private static readonly string redisPort = ConfigurationManager.AppSettings["Redis_Port"];
  18. private RedisCommon()
  19. {
  20.  
  21. }
  22. public static RedisCommon getInstance
  23. {
  24. get
  25. {
  26. return _instance.Value;
  27. }
  28. }
  29.  
  30. public RedisClient getRedisClient()
  31. {
  32. return new RedisClient(redisUrl, int.Parse(redisPort));
  33. }
  34.  
  35. #region string类型操作
  36.  
  37. /// <summary>
  38. /// 根据key获取对应的对象T
  39. /// </summary>
  40. /// <typeparam name="T"></typeparam>
  41. /// <param name="key"></param>
  42. /// <returns></returns>
  43. public T GetObj<T>(string key)
  44. {
  45. T result;
  46. try
  47. {
  48. using (var redis = this.getRedisClient())
  49. {
  50. result = redis.Get<T>(key);
  51. }
  52. }
  53. catch (Exception)
  54. {
  55.  
  56. result = default(T);
  57. }
  58. return result;
  59. }
  60.  
  61. /// <summary>
  62. /// 根据key存储T对象
  63. /// </summary>
  64. /// <typeparam name="T"></typeparam>
  65. /// <param name="key"></param>
  66. /// <param name="val"></param>
  67. /// <param name="dateTime"></param>
  68. /// <returns></returns>
  69. public bool SetObj<T>(string key, T val, DateTime dateTime)
  70. {
  71. bool result = false;
  72. try
  73. {
  74. using (var redis = this.getRedisClient())
  75. {
  76. result = redis.Set<T>(key, val, dateTime);
  77. }
  78. }
  79. catch
  80. {
  81.  
  82. result = false;
  83. }
  84. return result;
  85. }
  86.  
  87. /// <summary>
  88. /// 根据key更新T
  89. /// </summary>
  90. /// <typeparam name="T"></typeparam>
  91. /// <param name="key"></param>
  92. /// <param name="t"></param>
  93. /// <returns></returns>
  94. public bool UpdateObj<T>(string key, T t)
  95. {
  96. bool result = false;
  97. using (var redis = this.getRedisClient())
  98. {
  99. var value = JsonConvert.SerializeObject(t);
  100. result = redis.Set<string>(key, value);
  101. }
  102. return result;
  103. }
  104.  
  105. /// <summary>
  106. /// 删除对应key的value
  107. /// </summary>
  108. /// <param name="key"></param>
  109. /// <returns></returns>
  110. public bool RemoveObj(string key)
  111. {
  112. bool result = false;
  113. using (var redis = this.getRedisClient())
  114. {
  115. result = redis.Remove(key);
  116. }
  117. return result;
  118. }
  119. #endregion
  120.  
  121. #region hash类型操作
  122.  
  123. /// <summary>
  124. /// 从hash表获取数据
  125. /// </summary>
  126. public T Get<T>(string hashId, string key)
  127. {
  128. using (var redis = this.getRedisClient())
  129. {
  130. string value = redis.GetValueFromHash(hashId, key);
  131. return JsonConvert.DeserializeObject<T>(value);
  132. }
  133. }
  134.  
  135. /// <summary>
  136. /// 获取整个hash的数据
  137. /// </summary>
  138. public List<T> GetAll<T>(string hashId)
  139. {
  140. using (var redis = this.getRedisClient())
  141. {
  142. var result = new List<T>();
  143. var list = redis.GetHashValues(hashId);
  144. if (list != null && list.Count > )
  145. {
  146. list.ForEach(x =>
  147. {
  148. var value = JsonConvert.DeserializeObject<T>(x);
  149. result.Add(value);
  150. });
  151. }
  152. return result;
  153. }
  154. }
  155.  
  156. /// <summary>
  157. /// 判断某个数据是否已经被缓存
  158. /// </summary>
  159. public bool Exist<T>(string hashId, string key)
  160. {
  161. bool result = false;
  162. using (var redis = this.getRedisClient())
  163. {
  164. result = redis.HashContainsEntry(hashId, key);
  165. }
  166. return result;
  167. }
  168.  
  169. /// <summary>
  170. /// 存储数据到hash表
  171. /// </summary>
  172. public bool Set<T>(string hashId, string key, T t)
  173. {
  174. bool result = false;
  175. try
  176. {
  177. using (var redis = this.getRedisClient())
  178. {
  179. var value = JsonConvert.SerializeObject(t);
  180. result = redis.SetEntryInHash(hashId, key, value);
  181. }
  182. }
  183. catch
  184. {
  185.  
  186. result = false;
  187. }
  188. return result;
  189. }
  190.  
  191. /// <summary>
  192. /// 移除hash中的某值
  193. /// </summary>
  194. public bool Remove(string hashId, string key)
  195. {
  196. bool result = false;
  197. try
  198. {
  199. using (var redis = this.getRedisClient())
  200. {
  201. result = redis.RemoveEntryFromHash(hashId, key);
  202. }
  203. }
  204. catch
  205. {
  206. result = false;
  207. }
  208. return result;
  209. }
  210.  
  211. /// <summary>
  212. /// 移除整个hash
  213. /// </summary>
  214. public bool RemoveAll(string hashId)
  215. {
  216. bool result = false;
  217. using (var redis = this.getRedisClient())
  218. {
  219. result = redis.Remove(hashId);
  220. }
  221. return result;
  222. }
  223.  
  224. /// <summary>
  225. /// 设置缓存过期
  226. /// </summary>
  227. public void SetExpire(string hashId, DateTime datetime)
  228. {
  229. using (var redis = this.getRedisClient())
  230. {
  231. redis.ExpireEntryAt(hashId, datetime);
  232. }
  233. }
  234.  
  235. #endregion
  236.  
  237. #region 保存到硬盘
  238. /// <summary>
  239. /// 保存数据DB文件到硬盘
  240. /// </summary>
  241. public void Save()
  242. {
  243. using (var redis = this.getRedisClient())
  244. {
  245. redis.Save();
  246. }
  247. }
  248.  
  249. /// <summary>
  250. /// 异步保存数据DB文件到硬盘
  251. /// </summary>
  252. public void SaveAsync()
  253. {
  254. using (var redis = this.getRedisClient())
  255. {
  256. redis.SaveAsync();
  257. }
  258. }
  259. #endregion
  260. }
  261. }

操作:

  1. //var key = "AoVxQ-hvZGB6occUbGNiO-f4hiWzVhbYARheytOP5CyE";
  2. //for (var i = 0; i < 10; i++)
  3. //{
  4. // RedisCommon.getInstance.Set<String>("hongda", key + (i + 1), "hongda" + (i + 1));
  5. //}
  6.  
  7. //RedisCommon.getInstance.Set<String>("hongda", "AoVxQ-hvZGB6occUbGNiO-f4hiWzVhbYARheytOP5CyE9", "hongda9999");
  8.  
  9. //var aa=RedisCommon.getInstance.GetAll<string>("hongda");
  10.  
  11. //var bb =RedisCommon.getInstance.Get<string>("hongda", "AoVxQ-hvZGB6occUbGNiO-f4hiWzVhbYARheytOP5CyE9");
  12.  
  13. //RedisCommon.getInstance.Remove("hongda", "AoVxQ-hvZGB6occUbGNiO-f4hiWzVhbYARheytOP5CyE8");
  14.  
  15. RedisCommon.getInstance.RemoveAll("hongda");

第三方的更完善版本:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Configuration;
  7. using ServiceStack.Redis;
  8.  
  9. namespace Rongzi.BZone.Common.Util
  10. {
  11. public class RedisBase
  12. {
  13. private static string RedisPath = ConfigurationManager.AppSettings["RedisPath"];
  14.  
  15. #region -- 连接信息 --
  16. //10.0.18.8:6379
  17. public static PooledRedisClientManager prcm = CreateManager(new string[] { RedisPath }, new string[] { RedisPath });
  18. private static PooledRedisClientManager CreateManager(string[] readWriteHosts, string[] readOnlyHosts)
  19. {
  20. // 支持读写分离,均衡负载
  21. return new PooledRedisClientManager(readWriteHosts, readOnlyHosts, new RedisClientManagerConfig
  22. {
  23. MaxWritePoolSize = , // “写”链接池链接数
  24. MaxReadPoolSize = , // “读”链接池链接数
  25. AutoStart = true,
  26. });
  27. }
  28. #endregion
  29.  
  30. #region -- Item --
  31. /// <summary>
  32. /// 设置单体
  33. /// </summary>
  34. /// <typeparam name="T"></typeparam>
  35. /// <param name="key"></param>
  36. /// <param name="t"></param>
  37. /// <param name="timeSpan"></param>
  38. /// <returns></returns>
  39. public static bool Item_Set<T>(string key, T t)
  40. {
  41. try
  42. {
  43. using (IRedisClient redis = prcm.GetClient())
  44. {
  45. return redis.Set<T>(key, t, new TimeSpan(, , ));
  46. }
  47. }
  48. catch (Exception ex)
  49. {
  50. // LogInfo
  51. }
  52. return false;
  53. }
  54.  
  55. /// <summary>
  56. /// 获取单体
  57. /// </summary>
  58. /// <typeparam name="T"></typeparam>
  59. /// <param name="key"></param>
  60. /// <returns></returns>
  61. public static T Item_Get<T>(string key) where T : class
  62. {
  63. using (IRedisClient redis = prcm.GetClient())
  64. {
  65. return redis.Get<T>(key);
  66. }
  67. }
  68.  
  69. /// <summary>
  70. /// 移除单体
  71. /// </summary>
  72. /// <param name="key"></param>
  73. public static bool Item_Remove(string key)
  74. {
  75. using (IRedisClient redis = prcm.GetClient())
  76. {
  77. return redis.Remove(key);
  78. }
  79. }
  80.  
  81. #endregion
  82.  
  83. #region -- List --
  84.  
  85. public static void List_Add<T>(string key, T t)
  86. {
  87. using (IRedisClient redis = prcm.GetClient())
  88. {
  89. var redisTypedClient = redis.GetTypedClient<T>();
  90. redisTypedClient.AddItemToList(redisTypedClient.Lists[key], t);
  91. }
  92. }
  93.  
  94. public static bool List_Remove<T>(string key, T t)
  95. {
  96. using (IRedisClient redis = prcm.GetClient())
  97. {
  98. var redisTypedClient = redis.GetTypedClient<T>();
  99. return redisTypedClient.RemoveItemFromList(redisTypedClient.Lists[key], t) > ;
  100. }
  101. }
  102. public static void List_RemoveAll<T>(string key)
  103. {
  104. using (IRedisClient redis = prcm.GetClient())
  105. {
  106. var redisTypedClient = redis.GetTypedClient<T>();
  107. redisTypedClient.Lists[key].RemoveAll();
  108. }
  109. }
  110.  
  111. public static int List_Count(string key)
  112. {
  113. using (IRedisClient redis = prcm.GetClient())
  114. {
  115. return redis.GetListCount(key);
  116. }
  117. }
  118.  
  119. public static List<T> List_GetRange<T>(string key, int start, int count)
  120. {
  121. using (IRedisClient redis = prcm.GetClient())
  122. {
  123. var c = redis.GetTypedClient<T>();
  124. return c.Lists[key].GetRange(start, start + count - );
  125. }
  126. }
  127.  
  128. public static List<T> List_GetList<T>(string key)
  129. {
  130. using (IRedisClient redis = prcm.GetClient())
  131. {
  132. var c = redis.GetTypedClient<T>();
  133. return c.Lists[key].GetRange(, c.Lists[key].Count);
  134. }
  135. }
  136.  
  137. public static List<T> List_GetList<T>(string key, int pageIndex, int pageSize)
  138. {
  139. int start = pageSize * (pageIndex - );
  140. return List_GetRange<T>(key, start, pageSize);
  141. }
  142.  
  143. /// <summary>
  144. /// 设置缓存过期
  145. /// </summary>
  146. /// <param name="key"></param>
  147. /// <param name="datetime"></param>
  148. public static void List_SetExpire(string key, DateTime datetime)
  149. {
  150. using (IRedisClient redis = prcm.GetClient())
  151. {
  152. redis.ExpireEntryAt(key, datetime);
  153. }
  154. }
  155. #endregion
  156.  
  157. #region -- Set --
  158. public static void Set_Add<T>(string key, T t)
  159. {
  160. using (IRedisClient redis = prcm.GetClient())
  161. {
  162. var redisTypedClient = redis.GetTypedClient<T>();
  163. redisTypedClient.Sets[key].Add(t);
  164. }
  165. }
  166. public static bool Set_Contains<T>(string key, T t)
  167. {
  168. using (IRedisClient redis = prcm.GetClient())
  169. {
  170. var redisTypedClient = redis.GetTypedClient<T>();
  171. return redisTypedClient.Sets[key].Contains(t);
  172. }
  173. }
  174. public static bool Set_Remove<T>(string key, T t)
  175. {
  176. using (IRedisClient redis = prcm.GetClient())
  177. {
  178. var redisTypedClient = redis.GetTypedClient<T>();
  179. return redisTypedClient.Sets[key].Remove(t);
  180. }
  181. }
  182. #endregion
  183.  
  184. #region -- Hash --
  185. /// <summary>
  186. /// 判断某个数据是否已经被缓存
  187. /// </summary>
  188. /// <typeparam name="T"></typeparam>
  189. /// <param name="key"></param>
  190. /// <param name="dataKey"></param>
  191. /// <returns></returns>
  192. public static bool Hash_Exist<T>(string key, string dataKey)
  193. {
  194. using (IRedisClient redis = prcm.GetClient())
  195. {
  196. return redis.HashContainsEntry(key, dataKey);
  197. }
  198. }
  199.  
  200. /// <summary>
  201. /// 存储数据到hash表
  202. /// </summary>
  203. /// <typeparam name="T"></typeparam>
  204. /// <param name="key"></param>
  205. /// <param name="dataKey"></param>
  206. /// <returns></returns>
  207. public static bool Hash_Set<T>(string key, string dataKey, T t)
  208. {
  209. using (IRedisClient redis = prcm.GetClient())
  210. {
  211. string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
  212. return redis.SetEntryInHash(key, dataKey, value);
  213. }
  214. }
  215. /// <summary>
  216. /// 移除hash中的某值
  217. /// </summary>
  218. /// <typeparam name="T"></typeparam>
  219. /// <param name="key"></param>
  220. /// <param name="dataKey"></param>
  221. /// <returns></returns>
  222. public static bool Hash_Remove(string key, string dataKey)
  223. {
  224. using (IRedisClient redis = prcm.GetClient())
  225. {
  226. return redis.RemoveEntryFromHash(key, dataKey);
  227. }
  228. }
  229. /// <summary>
  230. /// 移除整个hash
  231. /// </summary>
  232. /// <typeparam name="T"></typeparam>
  233. /// <param name="key"></param>
  234. /// <param name="dataKey"></param>
  235. /// <returns></returns>
  236. public static bool Hash_Remove(string key)
  237. {
  238. using (IRedisClient redis = prcm.GetClient())
  239. {
  240. return redis.Remove(key);
  241. }
  242. }
  243. /// <summary>
  244. /// 从hash表获取数据
  245. /// </summary>
  246. /// <typeparam name="T"></typeparam>
  247. /// <param name="key"></param>
  248. /// <param name="dataKey"></param>
  249. /// <returns></returns>
  250. public static T Hash_Get<T>(string key, string dataKey)
  251. {
  252. using (IRedisClient redis = prcm.GetClient())
  253. {
  254. string value = redis.GetValueFromHash(key, dataKey);
  255. return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(value);
  256. }
  257. }
  258. /// <summary>
  259. /// 获取整个hash的数据
  260. /// </summary>
  261. /// <typeparam name="T"></typeparam>
  262. /// <param name="key"></param>
  263. /// <returns></returns>
  264. public static List<T> Hash_GetAll<T>(string key)
  265. {
  266. using (IRedisClient redis = prcm.GetClient())
  267. {
  268. var list = redis.GetHashValues(key);
  269. if (list != null && list.Count > )
  270. {
  271. List<T> result = new List<T>();
  272. foreach (var item in list)
  273. {
  274. var value = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
  275. result.Add(value);
  276. }
  277. return result;
  278. }
  279. return null;
  280. }
  281. }
  282. /// <summary>
  283. /// 设置缓存过期
  284. /// </summary>
  285. /// <param name="key"></param>
  286. /// <param name="datetime"></param>
  287. public static void Hash_SetExpire(string key, DateTime datetime)
  288. {
  289. using (IRedisClient redis = prcm.GetClient())
  290. {
  291. redis.ExpireEntryAt(key, datetime);
  292. }
  293. }
  294. #endregion
  295.  
  296. #region -- SortedSet --
  297. /// <summary>
  298. /// 添加数据到 SortedSet
  299. /// </summary>
  300. /// <typeparam name="T"></typeparam>
  301. /// <param name="key"></param>
  302. /// <param name="t"></param>
  303. /// <param name="score"></param>
  304. public static bool SortedSet_Add<T>(string key, T t, double score)
  305. {
  306. using (IRedisClient redis = prcm.GetClient())
  307. {
  308. string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
  309. return redis.AddItemToSortedSet(key, value, score);
  310. }
  311. }
  312. /// <summary>
  313. /// 移除数据从SortedSet
  314. /// </summary>
  315. /// <typeparam name="T"></typeparam>
  316. /// <param name="key"></param>
  317. /// <param name="t"></param>
  318. /// <returns></returns>
  319. public static bool SortedSet_Remove<T>(string key, T t)
  320. {
  321. using (IRedisClient redis = prcm.GetClient())
  322. {
  323. string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
  324. return redis.RemoveItemFromSortedSet(key, value);
  325. }
  326. }
  327. /// <summary>
  328. /// 修剪SortedSet
  329. /// </summary>
  330. /// <param name="key"></param>
  331. /// <param name="size">保留的条数</param>
  332. /// <returns></returns>
  333. public static int SortedSet_Trim(string key, int size)
  334. {
  335. using (IRedisClient redis = prcm.GetClient())
  336. {
  337. return redis.RemoveRangeFromSortedSet(key, size, );
  338. }
  339. }
  340. /// <summary>
  341. /// 获取SortedSet的长度
  342. /// </summary>
  343. /// <param name="key"></param>
  344. /// <returns></returns>
  345. public static int SortedSet_Count(string key)
  346. {
  347. using (IRedisClient redis = prcm.GetClient())
  348. {
  349. return redis.GetSortedSetCount(key);
  350. }
  351. }
  352.  
  353. /// <summary>
  354. /// 获取SortedSet的分页数据
  355. /// </summary>
  356. /// <typeparam name="T"></typeparam>
  357. /// <param name="key"></param>
  358. /// <param name="pageIndex"></param>
  359. /// <param name="pageSize"></param>
  360. /// <returns></returns>
  361. public static List<T> SortedSet_GetList<T>(string key, int pageIndex, int pageSize)
  362. {
  363. using (IRedisClient redis = prcm.GetClient())
  364. {
  365. var list = redis.GetRangeFromSortedSet(key, (pageIndex - ) * pageSize, pageIndex * pageSize - );
  366. if (list != null && list.Count > )
  367. {
  368. List<T> result = new List<T>();
  369. foreach (var item in list)
  370. {
  371. var data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
  372. result.Add(data);
  373. }
  374. return result;
  375. }
  376. }
  377. return null;
  378. }
  379.  
  380. /// <summary>
  381. /// 获取SortedSet的全部数据
  382. /// </summary>
  383. /// <typeparam name="T"></typeparam>
  384. /// <param name="key"></param>
  385. /// <param name="pageIndex"></param>
  386. /// <param name="pageSize"></param>
  387. /// <returns></returns>
  388. public static List<T> SortedSet_GetListALL<T>(string key)
  389. {
  390. using (IRedisClient redis = prcm.GetClient())
  391. {
  392. var list = redis.GetRangeFromSortedSet(key, , );
  393. if (list != null && list.Count > )
  394. {
  395. List<T> result = new List<T>();
  396. foreach (var item in list)
  397. {
  398. var data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
  399. result.Add(data);
  400. }
  401. return result;
  402. }
  403. }
  404. return null;
  405. }
  406.  
  407. /// <summary>
  408. /// 设置缓存过期
  409. /// </summary>
  410. /// <param name="key"></param>
  411. /// <param name="datetime"></param>
  412. public static void SortedSet_SetExpire(string key, DateTime datetime)
  413. {
  414. using (IRedisClient redis = prcm.GetClient())
  415. {
  416. redis.ExpireEntryAt(key, datetime);
  417. }
  418. }
  419.  
  420. //public static double SortedSet_GetItemScore<T>(string key,T t)
  421. //{
  422. // using (IRedisClient redis = prcm.GetClient())
  423. // {
  424. // var data = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
  425. // return redis.GetItemScoreInSortedSet(key, data);
  426. // }
  427. // return 0;
  428. //}
  429.  
  430. #endregion
  431. }
  432. }

http://blog.csdn.net/wanlong360599336/article/details/46771477

http://blog.wx6.org/2013/349.htm

Redis一些基本的操作的更多相关文章

  1. Jedis对Redis的常用命令操作

    本篇主要总结一些Jedis对Redis的常用命令操作: 1.对key操作命令 2.对String操作命令 3.对List操作命令 4.对Set操作命令 5.对Hash操作命令 6.排序操作指令 一.项 ...

  2. Redis五大数据类型以及操作

    目录: 一.redis的两种链接方式 二.redis的字符串操作(string) 三.redis的列表操作(list) 四.redis的散列表操作(类似于字典里面嵌套字典) 五.redis的集合操作( ...

  3. redis 五大数据类型以及操作

    一.redis的两种链接方式 1.简单连接 import redis conn = redis.Redis(host='10.0.0.200',port=6379) conn.set('k1','年后 ...

  4. redis(Springboot中封装整合redis,java程序如何操作redis的5种基本数据类型)

    平常测试redis操作命令,可能用的是cmd窗口 操作redis,记录一下 java程序操作reids, 操作redis的方法 可以用Jedis ,在springboot 提供了两种 方法操作 Red ...

  5. 【Redis】使用Jedis操作Redis

    Jedis介绍 jedis就是集成了redis的一些命令操作,封装了redis的java客户端. Jedis使用 使用jedis需要引入jedis的jar包,下面提供了maven依赖 jedis.ja ...

  6. Redis学习---Redis的免密操作

    Redis的免密操作 问题解决[方式一]:当前这种linux配置redis密码的方法是一种临时的,如果redis重启之后密码就会失效 1.首先进入redis,如果没有开启redis则需要先开启: [r ...

  7. 第三百节,python操作redis缓存-其他常用操作,用于操作redis里的数据name,不论什么数据类型

    python操作redis缓存-其他常用操作,用于操作redis里的数据name,不论什么数据类型 delete(*names)根据删除redis中的任意数据类型 #!/usr/bin/env pyt ...

  8. springmvc+mybatis+redis实现查询插入操作

    最近在学习redis,虽然现在还不是很熟练.不过可以进行简单的框架整合开发. IDE:我使用的是IDEA.springmvc+spring+mybatis的整合这个我就不多说了,下面我们先进行这块的整 ...

  9. Redis五大数据类型及操作

    目录: 一.redis的两种链接方式 二.redis的字符串操作(string) 三.redis的列表操作(list) 四.redis的散列表操作(类似于字典里面嵌套字典) 五.redis的集合操作( ...

  10. [ecmagent][redis学习][1初识redis] redis安装+redis快速教程+python操作redis

    # redis安装 # redis安装教程 -- 服务器(ubuntu)安装redis服务 sudo apt-get install redis-server -- 源码安装 -- $ wget ht ...

随机推荐

  1. [转]禁用和启用链接(a元素|LinkButton)的js方法

    本文转自:http://www.cnblogs.com/beiguren/archive/2010/05/24/1742926.html 在Asp.net中,有时候需要禁用掉一个a链接元素. 在服务器 ...

  2. 安装Bind过程中提示丢失MSVCR110.dll的解决办法

    前几天在线安装Visual Studio 2012 Update 3,由于在线安装需要不断下载安装文件,时间很长,后来等不下去,就取消了,不幸的是VS启动不了了,弹出“devenv.exe – 系统错 ...

  3. 8. Add the dashboard

    Controller Node: 1. sudo apt-get install apache2 memcached libapache2-mod-wsgi openstack-dashboard   ...

  4. 获取文本文件的第N行内容

    在PowerShell中,可以通过Get-Content这个cmdlet来获取文本文件的内容.Get-Content将一个文本文件读取到一个数组中,每一个数组元素就是文件的一行内容.比如一个文本文件内 ...

  5. WITCH CHAPTER 0 [cry] 绝密开发中的史克威尔艾尼克斯的DX12技术演示全貌

    西川善司的[WITCH CHAPTER 0  cry]讲座 ~绝密开发中的史克威尔艾尼克斯的DX12技术演示全貌   注:日文原文地址: http://pc.watch.impress.co.jp/d ...

  6. 自用有线IP切换

    @echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※ @echo ※ ※ @echo ※ 本命令用于设置外网视频与内网打印切换IP地址 ※ @echo ※ ※ @echo ※ ※ @e ...

  7. mysqli_multi_query($link, $wsql)

    if (mysqli_multi_query($link, $wsql)) { do { if ($result = mysqli_store_result($link)) { mysqli_free ...

  8. freebsd 禁用root登录ssh并给普通用户登录权限

    转自http://www.linux521.com/2009/system/200904/2021.html http://www.myhack58.com/Article/48/67/2011/30 ...

  9. C#调用NPOI组件导出Excel表格

    把一个List集合的数据导出到Excel表格中 public static string RenderToExcel<T>(List<T> datas) { MemoryStr ...

  10. 切记CMYK图片格式在IE中将无法显示

    目前为止微软的Internet Explorer 浏览器IE6,IE7,IE8都不支持CMYK颜色模式图像 ,除IE外其他浏览器均能支持!所以大家要注意了 要选择RGB颜色模式,就可以了.