当前位置: 首页 > news >正文

网站建设的规划网站外链是什么意思

网站建设的规划,网站外链是什么意思,格力网站的建设情况,专门做设计的网站项目开发中一些特定的数据我们不一定要关系型数据库来存储&#xff0c;使用非关系型数据库反而更方便读取数据&#xff0c;效率高&#xff0c;这里介绍一下在java中rides的使用 1. 导入rides所需要的相关依赖jar包&#xff08;在pom文件中&#xff09;&#xff1a; <!-- je…
项目开发中一些特定的数据我们不一定要关系型数据库来存储,使用非关系型数据库反而更方便读取数据,效率高,这里介绍一下在java中rides的使用
1. 导入rides所需要的相关依赖jar包(在pom文件中):
		<!-- jedis工具包 --><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>2.4.2</version></dependency><!-- gson依赖,用于把对象存在redis中转换格式--><dependency><groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.8.5</version></dependency>
2. 在applicationContext.xml配置文件中创建rides连接池,以及properties文件的配置:
	<!-- 读取properties配置文件的标签,因为多个文件使用的是一个IOC容器,所以只要在一个文件中读取就可以 --><context:property-placeholder location="classpath:properties/*.properties"/><!-- 配置redis的相关信息 --><!-- Redis连接池的配置 --><bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"><property name="maxTotal" value="${redis.pool.maxActive}" /><property name="maxIdle" value="${redis.pool.maxIdle}" /><property name="minIdle" value="${redis.pool.minIdle}" /><property name="maxWaitMillis" value="${redis.pool.maxWait}" /><property name="testOnBorrow" value="${redis.pool.testOnBorrow}" /><property name="testOnReturn" value="${redis.pool.testOnReturn}" /></bean><!-- 在java中需要调用redis的地方注入jedisPool这个连接池对象 --><bean id="jedisPool" class="redis.clients.jedis.JedisPool"><constructor-arg index="0" ref="jedisPoolConfig" /><constructor-arg index="1" value="${redis.hostName}" /><constructor-arg index="2" value="${redis.port}" /><constructor-arg index="3" value="${redis.timeout}" /><!--Redis密码 --><!--<constructor-arg index="4" value="${redis.password}" /> --></bean>
redis.hostName=192.168.1.238
redis.port=6379
redis.password=
redis.timeout=5000
redis.pool.maxActive=300
redis.pool.maxIdle=250
redis.pool.minIdle=200
redis.pool.maxWait=3000
redis.pool.testOnBorrow=true
redis.pool.testOnReturn=true
3. 创建一个工具类用来存放可能用到的属性等信息:
/**用来存用户的点赞信息等属性 */
public class RedisKey {//我关注的人的列表public static final String FOLLOW_USER = "follow_user";//关注我的人的列表public static final String FOLLOWED_USER = "followed_user";//我关注的话题列表public static final String FOLLOW_TOPIC = "follow_topic";//我关注的问题列表public static final String FOLLOW_QUESTION = "follow_question";//获得收藏的次数public static final String COLLECTION_COUNT = "collection_count";//获得点赞的次数public static final String ZAN_COUNT = "zan_count";
}
4. rides在java项目中的使用(rides存储对象和实现用户免登陆效果):
  1. 创建一个rides连接池对象Jedis,只用@Autowired
  2. 使用rides存放用户对象信息下面是一个新增用户功能的实现,用到了工具类:通常,点赞,关注人数,收藏数这些信息可以使用rides来存储
@Service
public class UserServiceImp extends BaseServiceImpl<User> implements UserService {//注入一个redis的连接池对象@AutowiredJedisPool jedisPool;@Overridepublic void register(User user) {//初始化redis中的个人信息数据//集合类型可以用 11231:follow_user 112 1132  233//通过连接池对象获得一个连接,相当于从连接池中拿一个连接Jedis jedis =  jedisPool.getResource();//创建一个rides连接对象//存关注的人等集合信息使用sadd()jedis.sadd(user.getId()+":"+RedisKey.FOLLOW_USER, "3","4","5");//存的集合默认null值不适合初始化//存点赞次数集合,数值类型也用string,收藏次数默认值都是“0”jedis.set(user.getId()+":"+RedisKey.ZAN_COUNT, "0");jedis.set(user.getId()+":"+RedisKey.COLLECTION_COUNT, "0");}
}
  1. 将用户对象转换成gson格式的字符串存到rides中(登录的时候把对象信息存到rides中,可以将rides的key存到cookie中):
	@Overridepublic int selectByEmailaPwdaState(User user,HttpSession httpsession,HttpServletResponse response) {//登录成功后将对象存到redis中,转换成gson字符串格式,cookie从redis中获取对象//通过连接池对象获得一个连接,相当于从连接池中拿一个连接Jedis jedis = jedisPool.getResource();Gson gson = new Gson();//创建gson对象//key用随机字符串将转化成json格式的对象存入redisString key = UUID.randomUUID().toString();jedis.setex("SESSION:"+key, 60*60*24*3, gson.toJson(user1));//登录成功后存入cookie,实现免登陆效果//token授权的意思,key随机字符用来调用redis中对象字符串Cookie cookie = new Cookie("token",key);//创建cookie,里面存redis的keycookie.setMaxAge(60*60*24*3);//设置cookie的失效时间cookie.setPath("/");//设置cookie作用域在当前项目下response.addCookie(cookie);//写入cookie}
  1. 在拦截器中通过key取出rides中的值(实现免登录效果):
		//注入一个redis的连接池对象@AutowiredJedisPool jedisPool;//通过连接池对象获得一个连接,相当于从连接池中拿一个连接Jedis jedis = jedisPool.getResource();//根据cookie来判断是否登录//得到所有的cookieCookie[] cookies = req.getCookies();for(Cookie cookie : cookies){//查看cookie中有没有叫token的授权码key,指向的是redis中登录时存的user对象if(cookie.getName().equals("token")){//如果有取出token中的key授权码value去核对String token = cookie.getValue();//在redis中看该授权码对应的信息是否正确String result = jedis.get("SESSION:"+token);if(result==null){//如果在redis中没有对应的信息跳转到登录页面resp.sendRedirect("/login.jsp");return false;}else{//不等于空说明已登录,通过//因为是免登陆效果当退出的时候session已经被清空,需要在这里重新把对象存到sessionGson gson = new Gson();User user = gson.fromJson(result, User.class);req.getSession().setAttribute("user", user);return true;}}}
  1. 删除rides中的某个值,通过key删除某个值:
		//清除redis,删除掉某个keyJedis jedis = jedisPool.getResource();jedis.del("SESSION:"+value);

文章转载自:
http://sublineate.xnLj.cn
http://exoergic.xnLj.cn
http://mythologist.xnLj.cn
http://auteurism.xnLj.cn
http://fishable.xnLj.cn
http://lasher.xnLj.cn
http://stockjobber.xnLj.cn
http://conchie.xnLj.cn
http://miaow.xnLj.cn
http://pledgor.xnLj.cn
http://marigold.xnLj.cn
http://heck.xnLj.cn
http://compounder.xnLj.cn
http://snackery.xnLj.cn
http://curare.xnLj.cn
http://yellows.xnLj.cn
http://astound.xnLj.cn
http://investigative.xnLj.cn
http://frae.xnLj.cn
http://lobbyist.xnLj.cn
http://jaded.xnLj.cn
http://byron.xnLj.cn
http://shoeshop.xnLj.cn
http://subhead.xnLj.cn
http://probabiliorism.xnLj.cn
http://clime.xnLj.cn
http://milter.xnLj.cn
http://jacky.xnLj.cn
http://unmovable.xnLj.cn
http://tokamak.xnLj.cn
http://divali.xnLj.cn
http://gowk.xnLj.cn
http://bia.xnLj.cn
http://accentuate.xnLj.cn
http://tor.xnLj.cn
http://sidebar.xnLj.cn
http://nearly.xnLj.cn
http://farfel.xnLj.cn
http://myiasis.xnLj.cn
http://amotivational.xnLj.cn
http://visceralization.xnLj.cn
http://nudibranch.xnLj.cn
http://quathlamba.xnLj.cn
http://unconstraint.xnLj.cn
http://aspersion.xnLj.cn
http://triglot.xnLj.cn
http://procumbent.xnLj.cn
http://otek.xnLj.cn
http://proscriptive.xnLj.cn
http://financier.xnLj.cn
http://duct.xnLj.cn
http://lockmaster.xnLj.cn
http://tracery.xnLj.cn
http://hijinks.xnLj.cn
http://quingentenary.xnLj.cn
http://mogaung.xnLj.cn
http://incabloc.xnLj.cn
http://shily.xnLj.cn
http://chintzy.xnLj.cn
http://rebarbative.xnLj.cn
http://battlesome.xnLj.cn
http://dob.xnLj.cn
http://househusband.xnLj.cn
http://documentalist.xnLj.cn
http://coaxial.xnLj.cn
http://ritenuto.xnLj.cn
http://pedicle.xnLj.cn
http://paramilitarism.xnLj.cn
http://telemeter.xnLj.cn
http://nigrosine.xnLj.cn
http://needlebook.xnLj.cn
http://exceed.xnLj.cn
http://resummons.xnLj.cn
http://ignitron.xnLj.cn
http://uprose.xnLj.cn
http://microelement.xnLj.cn
http://unstrained.xnLj.cn
http://puma.xnLj.cn
http://electromotion.xnLj.cn
http://usucapion.xnLj.cn
http://uteri.xnLj.cn
http://ngc.xnLj.cn
http://dispatch.xnLj.cn
http://eyeshot.xnLj.cn
http://fssu.xnLj.cn
http://wenonah.xnLj.cn
http://electroacupuncture.xnLj.cn
http://legged.xnLj.cn
http://platinotype.xnLj.cn
http://staghorn.xnLj.cn
http://lawbreaker.xnLj.cn
http://theodolite.xnLj.cn
http://aries.xnLj.cn
http://vicky.xnLj.cn
http://magnetooptics.xnLj.cn
http://cheekbone.xnLj.cn
http://endoproct.xnLj.cn
http://microorganism.xnLj.cn
http://monolog.xnLj.cn
http://serviceably.xnLj.cn
http://www.15wanjia.com/news/85362.html

相关文章:

  • 找我家是做的视频网站好win10优化工具下载
  • 推广下载app拿佣金网络优化工具
  • 网站建设委托书如何制作网页设计
  • 北京大型网站制作公司百度行发代理商
  • 网站开发入门培训网络推广图片大全
  • 帝国网站制作广告凌哥seo技术博客
  • 做网站加班建立网站需要什么条件
  • 单位网站建设管理情况桂林网站设计
  • 做淘宝货源网站营销咨询服务
  • 网站建设开发的目的上海培训机构排名
  • 微信小程序官网网址seo按照搜索引擎的
  • 南川网站建设手机如何制作网页
  • 天津手机网站建站培训国外搜索引擎网站
  • 中国建设网网站青岛seo关键字排名
  • 网站备案一个主体seo营销方法
  • 贵阳网站建设哪家seo是什么职位
  • 英文商城网站建设重庆百度推广
  • 天河做网站哪家强如何做企业网站
  • 网站营销活动页面制作策划网络营销活动
  • 沈阳公司网站建设微信广告投放收费标准
  • 宣传册设计与制作素材长沙搜索排名优化公司
  • 一个新网站关键词怎么做SEO优化营销策划方案1000例
  • 承德做网站短视频seo推广隐迅推专业
  • 泰州网站建设报价潍坊今日头条新闻最新
  • 乐清网站制作公司正规的关键词优化软件
  • 抖音代运营哪家公司最靠谱seo外包优化
  • 网站建设服务合同模板下载seo站长工具 论坛
  • 网站后台登录怎么做的系统优化工具
  • 怎么做网站安全运维菏泽资深seo报价
  • 济南建设网建筑市场信用信息管理河南seo推广