/**
* Copyright © 2012-2016
* <a href="https://github.com/thinkgem/smkj">smkj</a> All rights reserved.
*/
package com.sm.common.utils; import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.sm.common.config.Global;
import com.sm.utils.ObjectUtils;
import com.sm.utils.StringUtils;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisException; /**
* Jedis Cache 工具类
*
* @author ThinkGem
* @version 2014-6-29
*/
public class JedisUtils { private static Logger logger = LoggerFactory.getLogger(JedisUtils.class); private static JedisPool jedisPool = SpringContextHolder.getBean(JedisPool.class); public static final String KEY_PREFIX = Global.getConfig("redis.keyPrefix"); /**
* 获取缓存
*
* @param key
* 键
* @return 值
*/
public static String get(String key) {
String value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
value = jedis.get(key);
value = StringUtils.isNotBlank(value) && !"nil".equalsIgnoreCase(value) ? value : null;
logger.debug("get {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("get {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 获取缓存
*
* @param key
* 键
* @return 值
*/
public static Object getObject(String key) {
Object value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
value = toObject(jedis.get(getBytesKey(key)));
logger.debug("getObject {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getObject {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 设置缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static String set(String key, String value, int cacheSeconds) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.set(key, value);
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("set {} = {}", key, value);
} catch (Exception e) {
logger.warn("set {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 设置缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static String setObject(String key, Object value, int cacheSeconds) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.set(getBytesKey(key), toBytes(value));
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setObject {} = {}", key, value);
} catch (Exception e) {
logger.warn("setObject {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 获取List缓存
*
* @param key
* 键
* @return 值
*/
public static List<String> getList(String key) {
List<String> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
value = jedis.lrange(key, , -);
logger.debug("getList {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getList {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 获取List缓存
*
* @param key
* 键
* @return 值
*/
public static List<Object> getObjectList(String key) {
List<Object> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
List<byte[]> list = jedis.lrange(getBytesKey(key), , -);
value = Lists.newArrayList();
for (byte[] bs : list) {
value.add(toObject(bs));
}
logger.debug("getObjectList {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getObjectList {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 设置List缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static long setList(String key, List<String> value, int cacheSeconds) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
jedis.del(key);
}
result = jedis.rpush(key, (String[]) value.toArray());
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setList {} = {}", key, value);
} catch (Exception e) {
logger.warn("setList {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 设置List缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static long setObjectList(String key, List<Object> value, int cacheSeconds) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
jedis.del(key);
}
List<byte[]> list = Lists.newArrayList();
for (Object o : value) {
list.add(toBytes(o));
}
result = jedis.rpush(getBytesKey(key), (byte[][]) list.toArray());
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setObjectList {} = {}", key, value);
} catch (Exception e) {
logger.warn("setObjectList {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向List缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long listAdd(String key, String... value) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.rpush(key, value);
logger.debug("listAdd {} = {}", key, value);
} catch (Exception e) {
logger.warn("listAdd {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向List缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long listObjectAdd(String key, Object... value) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
List<byte[]> list = Lists.newArrayList();
for (Object o : value) {
list.add(toBytes(o));
}
result = jedis.rpush(getBytesKey(key), (byte[][]) list.toArray());
logger.debug("listObjectAdd {} = {}", key, value);
} catch (Exception e) {
logger.warn("listObjectAdd {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 获取缓存
*
* @param key
* 键
* @return 值
*/
public static Set<String> getSet(String key) {
Set<String> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
value = jedis.smembers(key);
logger.debug("getSet {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getSet {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 获取缓存
*
* @param key
* 键
* @return 值
*/
public static Set<Object> getObjectSet(String key) {
Set<Object> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
value = Sets.newHashSet();
Set<byte[]> set = jedis.smembers(getBytesKey(key));
for (byte[] bs : set) {
value.add(toObject(bs));
}
logger.debug("getObjectSet {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getObjectSet {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 设置Set缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static long setSet(String key, Set<String> value, int cacheSeconds) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
jedis.del(key);
}
result = jedis.sadd(key, (String[]) value.toArray());
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setSet {} = {}", key, value);
} catch (Exception e) {
logger.warn("setSet {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 设置Set缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static long setObjectSet(String key, Set<Object> value, int cacheSeconds) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
jedis.del(key);
}
Set<byte[]> set = Sets.newHashSet();
for (Object o : value) {
set.add(toBytes(o));
}
result = jedis.sadd(getBytesKey(key), (byte[][]) set.toArray());
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setObjectSet {} = {}", key, value);
} catch (Exception e) {
logger.warn("setObjectSet {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向Set缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long setSetAdd(String key, String... value) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.sadd(key, value);
logger.debug("setSetAdd {} = {}", key, value);
} catch (Exception e) {
logger.warn("setSetAdd {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向Set缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long setSetObjectAdd(String key, Object... value) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
Set<byte[]> set = Sets.newHashSet();
for (Object o : value) {
set.add(toBytes(o));
}
result = jedis.rpush(getBytesKey(key), (byte[][]) set.toArray());
logger.debug("setSetObjectAdd {} = {}", key, value);
} catch (Exception e) {
logger.warn("setSetObjectAdd {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 获取Map缓存
*
* @param key
* 键
* @return 值
*/
public static Map<String, String> getMap(String key) {
Map<String, String> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
value = jedis.hgetAll(key);
logger.debug("getMap {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getMap {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 获取Map缓存
*
* @param key
* 键
* @return 值
*/
public static Map<String, Object> getObjectMap(String key) {
Map<String, Object> value = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
value = Maps.newHashMap();
Map<byte[], byte[]> map = jedis.hgetAll(getBytesKey(key));
for (Map.Entry<byte[], byte[]> e : map.entrySet()) {
value.put(StringUtils.toString(e.getKey()), toObject(e.getValue()));
}
logger.debug("getObjectMap {} = {}", key, value);
}
} catch (Exception e) {
logger.warn("getObjectMap {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return value;
} /**
* 设置Map缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static String setMap(String key, Map<String, String> value, int cacheSeconds) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
jedis.del(key);
}
result = jedis.hmset(key, value);
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setMap {} = {}", key, value);
} catch (Exception e) {
logger.warn("setMap {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 设置Map缓存
*
* @param key
* 键
* @param value
* 值
* @param cacheSeconds
* 超时时间,0为不超时
* @return
*/
public static String setObjectMap(String key, Map<String, Object> value, int cacheSeconds) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
jedis.del(key);
}
Map<byte[], byte[]> map = Maps.newHashMap();
for (Map.Entry<String, Object> e : value.entrySet()) {
map.put(getBytesKey(e.getKey()), toBytes(e.getValue()));
}
result = jedis.hmset(getBytesKey(key), map);
if (cacheSeconds != ) {
jedis.expire(key, cacheSeconds);
}
logger.debug("setObjectMap {} = {}", key, value);
} catch (Exception e) {
logger.warn("setObjectMap {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向Map缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static String mapPut(String key, Map<String, String> value) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.hmset(key, value);
logger.debug("mapPut {} = {}", key, value);
} catch (Exception e) {
logger.warn("mapPut {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 向Map缓存中添加值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static String mapObjectPut(String key, Map<String, Object> value) {
String result = null;
Jedis jedis = null;
try {
jedis = getResource();
Map<byte[], byte[]> map = Maps.newHashMap();
for (Map.Entry<String, Object> e : value.entrySet()) {
map.put(getBytesKey(e.getKey()), toBytes(e.getValue()));
}
result = jedis.hmset(getBytesKey(key), map);
logger.debug("mapObjectPut {} = {}", key, value);
} catch (Exception e) {
logger.warn("mapObjectPut {} = {}", key, value, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 移除Map缓存中的值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long mapRemove(String key, String mapKey) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.hdel(key, mapKey);
logger.debug("mapRemove {} {}", key, mapKey);
} catch (Exception e) {
logger.warn("mapRemove {} {}", key, mapKey, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 移除Map缓存中的值
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static long mapObjectRemove(String key, String mapKey) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.hdel(getBytesKey(key), getBytesKey(mapKey));
logger.debug("mapObjectRemove {} {}", key, mapKey);
} catch (Exception e) {
logger.warn("mapObjectRemove {} {}", key, mapKey, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 判断Map缓存中的Key是否存在
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static boolean mapExists(String key, String mapKey) {
boolean result = false;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.hexists(key, mapKey);
logger.debug("mapExists {} {}", key, mapKey);
} catch (Exception e) {
logger.warn("mapExists {} {}", key, mapKey, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 判断Map缓存中的Key是否存在
*
* @param key
* 键
* @param value
* 值
* @return
*/
public static boolean mapObjectExists(String key, String mapKey) {
boolean result = false;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.hexists(getBytesKey(key), getBytesKey(mapKey));
logger.debug("mapObjectExists {} {}", key, mapKey);
} catch (Exception e) {
logger.warn("mapObjectExists {} {}", key, mapKey, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 删除缓存
*
* @param key
* 键
* @return
*/
public static long del(String key) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(key)) {
result = jedis.del(key);
logger.debug("del {}", key);
} else {
logger.debug("del {} not exists", key);
}
} catch (Exception e) {
logger.warn("del {}", key, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 删除缓存
*
* @param key
* 键
* @return
*/
public static long delObject(String key) {
long result = ;
Jedis jedis = null;
try {
jedis = getResource();
if (jedis.exists(getBytesKey(key))) {
result = jedis.del(getBytesKey(key));
logger.debug("delObject {}", key);
} else {
logger.debug("delObject {} not exists", key);
}
} catch (Exception e) {
logger.warn("delObject {}", key, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 缓存是否存在
*
* @param key
* 键
* @return
*/
public static boolean exists(String key) {
boolean result = false;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.exists(key);
logger.debug("exists {}", key);
} catch (Exception e) {
logger.warn("exists {}", key, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 缓存是否存在
*
* @param key
* 键
* @return
*/
public static boolean existsObject(String key) {
boolean result = false;
Jedis jedis = null;
try {
jedis = getResource();
result = jedis.exists(getBytesKey(key));
logger.debug("existsObject {}", key);
} catch (Exception e) {
logger.warn("existsObject {}", key, e);
} finally {
returnResource(jedis);
}
return result;
} /**
* 获取资源
*
* @return
* @throws JedisException
*/
public static Jedis getResource() throws JedisException {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
// logger.debug("getResource.", jedis);
} catch (JedisException e) {
logger.warn("getResource.", e);
returnBrokenResource(jedis);
throw e;
}
return jedis;
} /**
* 归还资源
*
* @param jedis
* @param isBroken
*/
public static void returnBrokenResource(Jedis jedis) {
if (jedis != null) {
jedisPool.returnBrokenResource(jedis);
}
} /**
* 释放资源
*
* @param jedis
* @param isBroken
*/
public static void returnResource(Jedis jedis) {
if (jedis != null) {
jedisPool.returnResource(jedis);
}
} /**
* 获取byte[]类型Key
*
* @param key
* @return
*/
public static byte[] getBytesKey(Object object) {
if (object instanceof String) {
return StringUtils.getBytes((String) object);
} else {
return ObjectUtils.serialize(object);
}
} /**
* 获取byte[]类型Key
*
* @param key
* @return
*/
public static Object getObjectKey(byte[] key) {
try {
return StringUtils.toString(key);
} catch (UnsupportedOperationException uoe) {
try {
return JedisUtils.toObject(key);
} catch (UnsupportedOperationException uoe2) {
uoe2.printStackTrace();
}
}
return null;
} /**
* Object转换byte[]类型
*
* @param key
* @return
*/
public static byte[] toBytes(Object object) {
return ObjectUtils.serialize(object);
} /**
* byte[]型转换Object
*
* @param key
* @return
*/
public static Object toObject(byte[] bytes) {
return ObjectUtils.unserialize(bytes);
} }
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
default-lazy-init="true"> <description>Jedis Configuration</description> <!-- 加载配置属性文件 -->
<context:property-placeholder ignore-unresolvable="true" location="classpath:smkj.properties" /> <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="" /> <!-- 最大能够保持idel状态的对象数 -->
<property name="maxTotal" value="" /> <!-- 最大分配的对象数 -->
<property name="testOnBorrow" value="true" /> <!-- 当调用borrow Object方法时,是否进行有效性检查 -->
</bean> <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="" ref="jedisPoolConfig" />
<constructor-arg index="" value="${redis.host}" />
<constructor-arg index="" value="${redis.port}" type="int" />
<!-- <constructor-arg index="" value="${redis.timeout}" type="int" />
<constructor-arg index="" value="${redis.password}"/>
<constructor-arg index="" value="${redis.database}" type="int" />
<constructor-arg index="" value="${redis.clientName}"/> -->
</bean> </beans>
redis.keyPrefix=smkj
redis.host=127.0.0.1
redis.port=

Redis工具类的更多相关文章

  1. Redis操作Hash工具类封装,Redis工具类封装

    Redis操作Hash工具类封装,Redis工具类封装 >>>>>>>>>>>>>>>>>> ...

  2. Redis操作字符串工具类封装,Redis工具类封装

    Redis操作字符串工具类封装,Redis工具类封装 >>>>>>>>>>>>>>>>>>& ...

  3. redis 工具类 单个redis、JedisPool 及多个redis、shardedJedisPool与spring的集成配置

    http://www.cnblogs.com/edisonfeng/p/3571870.html http://javacrazyer.iteye.com/blog/1840161 http://ww ...

  4. SpringBoot整合Redis及Redis工具类撰写

            SpringBoot整合Redis的博客很多,但是很多都不是我想要的结果.因为我只需要整合完成后,可以操作Redis就可以了,并不需要配合缓存相关的注解使用(如@Cacheable). ...

  5. redistemplate优雅地操作redis redis 工具类

    参考:https://www.cnblogs.com/superfj/p/9232482.html redis 工具类 package com.service; import org.springfr ...

  6. java的redis工具类

    package com.mracale.sell.utils; /** * @Auther: Mracale */ import org.springframework.beans.factory.a ...

  7. Redis 工具类

    项目里的Redis 工具类,写下来以备后用 public class RedisConnector { public class RedisParseResult<T> { public ...

  8. Redis 工具类 java 实现的redis 工具类

    最近了解了一下非关系型数据库 redis 会使用简单的命令 在自己本地电脑 使用时必须先启动服务器端 在启动客户端 redis 简介 Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内 ...

  9. Java操作Redis工具类

    依赖 jar 包 <dependency> <groupId>redis.clients</groupId> <artifactId>jedis< ...

  10. spring boot 使用redis 及redis工具类

    1-添加maven依赖 2-添加redis配置 3-工具类 1-添加maven依赖 实际上是封装了jedis <!-- redis 依赖--> <dependency> < ...

随机推荐

  1. d2-admin中那些不错的技巧

    d2-admin基于vue-cli3 路由相关 刷新路由,参照官方  组件内的守卫 但是搞不明白为何加了句 render:h => h() { path: 'refresh', name: 'r ...

  2. rem,em

    任意浏览器的默认字体高都是16px.所有未经调整的浏览器都符合: 1em=16px.那么12px=0.75em,10px=0.625em.为了简化font-size的换算,需要在css中的body选择 ...

  3. java工程师之旅-一个月工作心得

    不知不觉,在工作中已经度过一个月,距离上次写文章已经好几个月了,正好还有二十分钟下班,抽点时间来写一下博文,写一下心得. 首先说一下,在我工作之前,做了一个项目,和一个外校大四的学生做一个毕业设计,一 ...

  4. 2017-2018-2 165X 『Java程序设计』课程每周成绩公布

    2017-2018-2 165X 『Java程序设计』课程 每周成绩公布 本博客将跟随教学进度不定期更新,每次更新后将在课程群公布.如对成绩有疑问,请于公布成绩后的1天之内联系助教,进行审核确认. - ...

  5. redis实现消息队列&发布/订阅模式使用

    在项目中用到了redis作为缓存,再学习了ActiveMq之后想着用redis实现简单的消息队列,下面做记录.   Redis的列表类型键可以用来实现队列,并且支持阻塞式读取,可以很容易的实现一个高性 ...

  6. (原)tensorflow中使用指定的GPU及GPU显存

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6591923.html 参考网址: http://stackoverflow.com/questions ...

  7. git入门与实践【转】

    转自:http://www.cnblogs.com/shenhaocn/archive/2011/03/13/1982957.html 什么是版本控制 要了解什么是git,首先需要了解什么是版本控制( ...

  8. PhantomJSのメモいろいろ

    提供されるモジュール群は5つ phantom: そのもの FileSystem: ファイルに出力したり.依存ファイルの存在確認したり System: コマンドラインから引数取りたいなら WebPage ...

  9. Node 7.6默认支持Async/Await

    Node.js 7.6正式默认支持async/await功能,并能够使低内存设备获得更出色的性能. Node 7.6对async/await的支持来自于将V8(Chromium JavaScript引 ...

  10. Python3学习笔记08-tuple

    元组与列表类似,不同之处在于元组的元素不能修改 元组使用小括号,列表使用方括号 元组创建很简单,只需要在括号中添加元素,并使用逗号隔开即可 tup1 = ('Google', 'Runoob', 19 ...