redisHelper
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ServiceStack.Redis; namespace Com.QFGame.QNX.Community.Redis { public class RedisBase { private static string RedisPath = System.Configuration.ConfigurationSettings.AppSettings["RedisPath"]; #region -- 连接信息 -- //10.0.18.8:6379 public static PooledRedisClientManager prcm = CreateManager(new string[] { RedisPath }, new string[] { RedisPath }); private static PooledRedisClientManager CreateManager(string[] readWriteHosts, string[] readOnlyHosts) { // 支持读写分离,均衡负载 return new PooledRedisClientManager(readWriteHosts, readOnlyHosts, new RedisClientManagerConfig { MaxWritePoolSize = , // “写”链接池链接数 MaxReadPoolSize = , // “读”链接池链接数 AutoStart = true, }); } #endregion #region -- Item -- /// <summary> /// 设置单体 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="t"></param> /// <param name="timeSpan"></param> /// <returns></returns> public static bool Item_Set<T>(string key, T t) { try { using (IRedisClient redis = prcm.GetClient()) { return redis.Set<T>(key, t, new TimeSpan(, , )); } } catch (Exception ex) { // LogInfo } return false; } /// <summary> /// 获取单体 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public static T Item_Get<T>(string key) where T : class { using (IRedisClient redis = prcm.GetClient()) { return redis.Get<T>(key); } } /// <summary> /// 移除单体 /// </summary> /// <param name="key"></param> public static bool Item_Remove(string key) { using (IRedisClient redis = prcm.GetClient()) { return redis.Remove(key); } } #endregion #region -- List -- public static void List_Add<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); redisTypedClient.AddItemToList(redisTypedClient.Lists[key], t); } } public static bool List_Remove<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); return redisTypedClient.RemoveItemFromList(redisTypedClient.Lists[key], t) > ; } } public static void List_RemoveAll<T>(string key) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); redisTypedClient.Lists[key].RemoveAll(); } } public static int List_Count(string key) { using (IRedisClient redis = prcm.GetClient()) { return redis.GetListCount(key); } } public static List<T> List_GetRange<T>(string key, int start, int count) { using (IRedisClient redis = prcm.GetClient()) { var c = redis.GetTypedClient<T>(); return c.Lists[key].GetRange(start, start + count - ); } } public static List<T> List_GetList<T>(string key) { using (IRedisClient redis = prcm.GetClient()) { var c = redis.GetTypedClient<T>(); return c.Lists[key].GetRange(, c.Lists[key].Count); } } public static List<T> List_GetList<T>(string key, int pageIndex, int pageSize) { int start = pageSize * (pageIndex - ); return List_GetRange<T>(key, start, pageSize); } /// <summary> /// 设置缓存过期 /// </summary> /// <param name="key"></param> /// <param name="datetime"></param> public static void List_SetExpire(string key, DateTime datetime) { using (IRedisClient redis = prcm.GetClient()) { redis.ExpireEntryAt(key, datetime); } } #endregion #region -- Set -- public static void Set_Add<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); redisTypedClient.Sets[key].Add(t); } } public static bool Set_Contains<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); return redisTypedClient.Sets[key].Contains(t); } } public static bool Set_Remove<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { var redisTypedClient = redis.GetTypedClient<T>(); return redisTypedClient.Sets[key].Remove(t); } } #endregion #region -- Hash -- /// <summary> /// 判断某个数据是否已经被缓存 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="dataKey"></param> /// <returns></returns> public static bool Hash_Exist<T>(string key, string dataKey) { using (IRedisClient redis = prcm.GetClient()) { return redis.HashContainsEntry(key, dataKey); } } /// <summary> /// 存储数据到hash表 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="dataKey"></param> /// <returns></returns> public static bool Hash_Set<T>(string key, string dataKey, T t) { using (IRedisClient redis = prcm.GetClient()) { string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t); return redis.SetEntryInHash(key, dataKey, value); } } /// <summary> /// 移除hash中的某值 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="dataKey"></param> /// <returns></returns> public static bool Hash_Remove(string key, string dataKey) { using (IRedisClient redis = prcm.GetClient()) { return redis.RemoveEntryFromHash(key, dataKey); } } /// <summary> /// 移除整个hash /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="dataKey"></param> /// <returns></returns> public static bool Hash_Remove(string key) { using (IRedisClient redis = prcm.GetClient()) { return redis.Remove(key); } } /// <summary> /// 从hash表获取数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="dataKey"></param> /// <returns></returns> public static T Hash_Get<T>(string key, string dataKey) { using (IRedisClient redis = prcm.GetClient()) { string value = redis.GetValueFromHash(key, dataKey); return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(value); } } /// <summary> /// 获取整个hash的数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public static List<T> Hash_GetAll<T>(string key) { using (IRedisClient redis = prcm.GetClient()) { var list = redis.GetHashValues(key); if (list != null && list.Count > ) { List<T> result = new List<T>(); foreach (var item in list) { var value = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item); result.Add(value); } return result; } return null; } } /// <summary> /// 设置缓存过期 /// </summary> /// <param name="key"></param> /// <param name="datetime"></param> public static void Hash_SetExpire(string key, DateTime datetime) { using (IRedisClient redis = prcm.GetClient()) { redis.ExpireEntryAt(key, datetime); } } #endregion #region -- SortedSet -- /// <summary> /// 添加数据到 SortedSet /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="t"></param> /// <param name="score"></param> public static bool SortedSet_Add<T>(string key, T t, double score) { using (IRedisClient redis = prcm.GetClient()) { string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t); return redis.AddItemToSortedSet(key, value, score); } } /// <summary> /// 移除数据从SortedSet /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="t"></param> /// <returns></returns> public static bool SortedSet_Remove<T>(string key, T t) { using (IRedisClient redis = prcm.GetClient()) { string value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t); return redis.RemoveItemFromSortedSet(key, value); } } /// <summary> /// 修剪SortedSet /// </summary> /// <param name="key"></param> /// <param name="size">保留的条数</param> /// <returns></returns> public static int SortedSet_Trim(string key, int size) { using (IRedisClient redis = prcm.GetClient()) { return redis.RemoveRangeFromSortedSet(key, size, ); } } /// <summary> /// 获取SortedSet的长度 /// </summary> /// <param name="key"></param> /// <returns></returns> public static int SortedSet_Count(string key) { using (IRedisClient redis = prcm.GetClient()) { return redis.GetSortedSetCount(key); } } /// <summary> /// 获取SortedSet的分页数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public static List<T> SortedSet_GetList<T>(string key, int pageIndex, int pageSize) { using (IRedisClient redis = prcm.GetClient()) { var list = redis.GetRangeFromSortedSet(key, (pageIndex - ) * pageSize, pageIndex * pageSize - ); if (list != null && list.Count > ) { List<T> result = new List<T>(); foreach (var item in list) { var data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item); result.Add(data); } return result; } } return null; } /// <summary> /// 获取SortedSet的全部数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public static List<T> SortedSet_GetListALL<T>(string key) { using (IRedisClient redis = prcm.GetClient()) { var list = redis.GetRangeFromSortedSet(key, , ); if (list != null && list.Count > ) { List<T> result = new List<T>(); foreach (var item in list) { var data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item); result.Add(data); } return result; } } return null; } /// <summary> /// 设置缓存过期 /// </summary> /// <param name="key"></param> /// <param name="datetime"></param> public static void SortedSet_SetExpire(string key, DateTime datetime) { using (IRedisClient redis = prcm.GetClient()) { redis.ExpireEntryAt(key, datetime); } } //public static double SortedSet_GetItemScore<T>(string key,T t) //{ // using (IRedisClient redis = prcm.GetClient()) // { // var data = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t); // return redis.GetItemScoreInSortedSet(key, data); // } // return 0; //} #endregion } }
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
ServiceStack.Redis;
namespace
Com.QFGame.QNX.Community.Redis
{
public
class
RedisBase
{
private
static
string
RedisPath = System.Configuration.ConfigurationSettings.AppSettings[
"RedisPath"
];
#region -- 连接信息 --
//10.0.18.8:6379
public
static
PooledRedisClientManager prcm = CreateManager(
new
string
[] { RedisPath },
new
string
[] { RedisPath });
private
static
PooledRedisClientManager CreateManager(
string
[] readWriteHosts,
string
[] readOnlyHosts)
{
// 支持读写分离,均衡负载
return
new
PooledRedisClientManager(readWriteHosts, readOnlyHosts,
new
RedisClientManagerConfig
{
MaxWritePoolSize = 5,
// “写”链接池链接数
MaxReadPoolSize = 5,
// “读”链接池链接数
AutoStart =
true
,
});
}
#endregion
#region -- Item --
/// <summary>
/// 设置单体
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="t"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public
static
bool
Item_Set<T>(
string
key, T t)
{
try
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.Set<T>(key, t,
new
TimeSpan(1, 0, 0));
}
}
catch
(Exception ex)
{
// LogInfo
}
return
false
;
}
/// <summary>
/// 获取单体
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public
static
T Item_Get<T>(
string
key)
where
T :
class
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.Get<T>(key);
}
}
/// <summary>
/// 移除单体
/// </summary>
/// <param name="key"></param>
public
static
bool
Item_Remove(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.Remove(key);
}
}
#endregion
#region -- List --
public
static
void
List_Add<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
redisTypedClient.AddItemToList(redisTypedClient.Lists[key], t);
}
}
public
static
bool
List_Remove<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
return
redisTypedClient.RemoveItemFromList(redisTypedClient.Lists[key], t) > 0;
}
}
public
static
void
List_RemoveAll<T>(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
redisTypedClient.Lists[key].RemoveAll();
}
}
public
static
int
List_Count(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.GetListCount(key);
}
}
public
static
List<T> List_GetRange<T>(
string
key,
int
start,
int
count)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
c = redis.GetTypedClient<T>();
return
c.Lists[key].GetRange(start, start + count - 1);
}
}
public
static
List<T> List_GetList<T>(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
c = redis.GetTypedClient<T>();
return
c.Lists[key].GetRange(0, c.Lists[key].Count);
}
}
public
static
List<T> List_GetList<T>(
string
key,
int
pageIndex,
int
pageSize)
{
int
start = pageSize * (pageIndex - 1);
return
List_GetRange<T>(key, start, pageSize);
}
/// <summary>
/// 设置缓存过期
/// </summary>
/// <param name="key"></param>
/// <param name="datetime"></param>
public
static
void
List_SetExpire(
string
key, DateTime datetime)
{
using
(IRedisClient redis = prcm.GetClient())
{
redis.ExpireEntryAt(key, datetime);
}
}
#endregion
#region -- Set --
public
static
void
Set_Add<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
redisTypedClient.Sets[key].Add(t);
}
}
public
static
bool
Set_Contains<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
return
redisTypedClient.Sets[key].Contains(t);
}
}
public
static
bool
Set_Remove<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
redisTypedClient = redis.GetTypedClient<T>();
return
redisTypedClient.Sets[key].Remove(t);
}
}
#endregion
#region -- Hash --
/// <summary>
/// 判断某个数据是否已经被缓存
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dataKey"></param>
/// <returns></returns>
public
static
bool
Hash_Exist<T>(
string
key,
string
dataKey)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.HashContainsEntry(key, dataKey);
}
}
/// <summary>
/// 存储数据到hash表
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dataKey"></param>
/// <returns></returns>
public
static
bool
Hash_Set<T>(
string
key,
string
dataKey, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
string
value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
return
redis.SetEntryInHash(key, dataKey, value);
}
}
/// <summary>
/// 移除hash中的某值
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dataKey"></param>
/// <returns></returns>
public
static
bool
Hash_Remove(
string
key,
string
dataKey)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.RemoveEntryFromHash(key, dataKey);
}
}
/// <summary>
/// 移除整个hash
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dataKey"></param>
/// <returns></returns>
public
static
bool
Hash_Remove(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.Remove(key);
}
}
/// <summary>
/// 从hash表获取数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dataKey"></param>
/// <returns></returns>
public
static
T Hash_Get<T>(
string
key,
string
dataKey)
{
using
(IRedisClient redis = prcm.GetClient())
{
string
value = redis.GetValueFromHash(key, dataKey);
return
ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(value);
}
}
/// <summary>
/// 获取整个hash的数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public
static
List<T> Hash_GetAll<T>(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
list = redis.GetHashValues(key);
if
(list !=
null
&& list.Count > 0)
{
List<T> result =
new
List<T>();
foreach
(
var
item
in
list)
{
var
value = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
result.Add(value);
}
return
result;
}
return
null
;
}
}
/// <summary>
/// 设置缓存过期
/// </summary>
/// <param name="key"></param>
/// <param name="datetime"></param>
public
static
void
Hash_SetExpire(
string
key, DateTime datetime)
{
using
(IRedisClient redis = prcm.GetClient())
{
redis.ExpireEntryAt(key, datetime);
}
}
#endregion
#region -- SortedSet --
/// <summary>
/// 添加数据到 SortedSet
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="t"></param>
/// <param name="score"></param>
public
static
bool
SortedSet_Add<T>(
string
key, T t,
double
score)
{
using
(IRedisClient redis = prcm.GetClient())
{
string
value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
return
redis.AddItemToSortedSet(key, value, score);
}
}
/// <summary>
/// 移除数据从SortedSet
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="t"></param>
/// <returns></returns>
public
static
bool
SortedSet_Remove<T>(
string
key, T t)
{
using
(IRedisClient redis = prcm.GetClient())
{
string
value = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
return
redis.RemoveItemFromSortedSet(key, value);
}
}
/// <summary>
/// 修剪SortedSet
/// </summary>
/// <param name="key"></param>
/// <param name="size">保留的条数</param>
/// <returns></returns>
public
static
int
SortedSet_Trim(
string
key,
int
size)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.RemoveRangeFromSortedSet(key, size, 9999999);
}
}
/// <summary>
/// 获取SortedSet的长度
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public
static
int
SortedSet_Count(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
return
redis.GetSortedSetCount(key);
}
}
/// <summary>
/// 获取SortedSet的分页数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public
static
List<T> SortedSet_GetList<T>(
string
key,
int
pageIndex,
int
pageSize)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
list = redis.GetRangeFromSortedSet(key, (pageIndex - 1) * pageSize, pageIndex * pageSize - 1);
if
(list !=
null
&& list.Count > 0)
{
List<T> result =
new
List<T>();
foreach
(
var
item
in
list)
{
var
data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
result.Add(data);
}
return
result;
}
}
return
null
;
}
/// <summary>
/// 获取SortedSet的全部数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public
static
List<T> SortedSet_GetListALL<T>(
string
key)
{
using
(IRedisClient redis = prcm.GetClient())
{
var
list = redis.GetRangeFromSortedSet(key, 0, 9999999);
if
(list !=
null
&& list.Count > 0)
{
List<T> result =
new
List<T>();
foreach
(
var
item
in
list)
{
var
data = ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(item);
result.Add(data);
}
return
result;
}
}
return
null
;
}
/// <summary>
/// 设置缓存过期
/// </summary>
/// <param name="key"></param>
/// <param name="datetime"></param>
public
static
void
SortedSet_SetExpire(
string
key, DateTime datetime)
{
using
(IRedisClient redis = prcm.GetClient())
{
redis.ExpireEntryAt(key, datetime);
}
}
//public static double SortedSet_GetItemScore<T>(string key,T t)
//{
// using (IRedisClient redis = prcm.GetClient())
// {
// var data = ServiceStack.Text.JsonSerializer.SerializeToString<T>(t);
// return redis.GetItemScoreInSortedSet(key, data);
// }
// return 0;
//}
#endregion
}
}
redisHelper的更多相关文章
- Basic Tutorials of Redis(9) -First Edition RedisHelper
After learning the basic opreation of Redis,we should take some time to summarize the usage. And I w ...
- C# Azure 存储-分布式缓存Redis工具类 RedisHelper
using System; using System.Collections.Generic; using Newtonsoft.Json; using StackExchange.Redis; na ...
- Asp.Net Core 2.0 项目实战(6)Redis配置、封装帮助类RedisHelper及使用实例
本文目录 1. 摘要 2. Redis配置 3. RedisHelper 4.使用实例 5. 总结 1. 摘要 由于內存存取速度远高于磁盘读取的特性,为了程序效率提高性能,通常会把常用的不常变动的数 ...
- [C#] 使用 StackExchange.Redis 封装属于自己的 RedisHelper
使用 StackExchange.Redis 封装属于自己的 RedisHelper 目录 核心类 ConnectionMultiplexer 字符串(String) 哈希(Hash) 列表(List ...
- RedisHelper帮助类
using Newtonsoft.Json; using RedLockNet.SERedis; using RedLockNet.SERedis.Configuration; using Stack ...
- RedisHelper in C#
自己写了一个RedisHelper,现贴出来,希望各位大神能够指正和优化. using System; using StackExchange.Redis; using System.Configur ...
- 使用 StackExchange.Redis 封装属于自己的 RedisHelper
目录 核心类 ConnectionMultiplexer 字符串(String) 哈希(Hash) 列表(List) 有序集合(sorted set) Key 操作 发布订阅 其他 简介 目前 .NE ...
- RedisHelper (C#)
<add key="RedisServers" value="172.20.2.90:9379,password=Aa+123456789" /> ...
- RedisHelper Redis帮助类
using StackExchange.Redis; using System; using System.Collections.Generic; using System.IO; using Sy ...
- Redis:RedisHelper(5)
/// <summary> /// Redis 助手 /// </summary> public class RedisHelper { /// <summary> ...
随机推荐
- mysql取电话号码的后四位字符
SELECT id, RIGHT (phone,4) from user where id= 'xxxxxx'
- .NET 中的 async/await 异步编程
原文出处: Teroy 的博客 前言 最近在学习Web Api框架的时候接触到了async/await,这个特性是.NET 4.5引入的,由于之前对于异步编程不是很了解,所以花费了一些时间学习一下相关 ...
- Linux 中的网络数据包捕获
Linux 中的网络数据包捕获 Ashish Chaurasia, 工程师 简介: 本教程介绍了捕获和操纵数据包的不同机制.安全应用程序,如 VPN.防火墙和嗅探器,以及网络应用程序,如路由程序,都依 ...
- win32获取浏览器当前Tab的URL
代码都是win10上测试的 1. 获取IE的URL,Enum IE窗口的子句柄,找到className为Edit的句柄,然后用SendMessage WM_GETTEXT消息来获取: 上代码: #in ...
- mac下phpstrom安装主题和主题推荐
phpstorm主题 在mac下finder下command+shift+G键到~/Library/Preferences/PhpStorm2016.2/colors,我的路径可能和你的不同,但是大同 ...
- awbeci网站之技术篇
之前写的一篇关于awbeci网站的使用和介绍,大家可以看看,地址在:http://www.cnblogs.com/zhangwei595806165/p/5245640.html 1.前台 BootS ...
- android如何查看cpu的占用率和内存泄漏
在分析内存优化的过程中,其中一个最重要的是我们如何查看cpu的占用率和内存的占用率呢,这在一定程度上很重要,经过查询资料,研究了一下,暂时了解到大概有以下几种方式,如果哪位高手有更好的办法,或者文中描 ...
- Swift3 获取系统音量和监听系统音量
使用时: //定义滑动条用于显示音量 @IBOutlet weak var volumSlider: UISlider! //处理声音,获取当前音量,并添加监听 handleVolum() 方法内容: ...
- 【SqlServer】SqlServer索引的创建、查看、删除
索引加快检索表中数据的方法,它对数据表中一个或者多个列的值进行结构排序,是数据库中一个非常有用的对象. 索引的创建 #1使用企业管理器创建 启动企业管理器--选择数据库------选在要创建索引的表- ...
- 【MongoDB】MongoDB的java驱动包使用
要在Java中使用Mongo数据库 首先导入驱动包mongo-java-driver.jar. 然后获得库,获得集合.就可以对数据库操作了,比如: //创建MongoClient对象 MongoCli ...