当前位置:   article > 正文

设置简单Cookie缓存_怎么写cookie缓存

怎么写cookie缓存
    HttpServletResponse response = ThreadContextHolder.getHttpResponse();

    HttpServletRequest request = ThreadContextHolder.getHttpRequest();

    String usercok = HttpUtil.getCookieValue(request , "usercok");//查看cookie中是否有usercok标识的缓存

    if(StringUtil.isEmpty(usercok)){//判断是否存在

        HttpUtil.addCookie(response, "usercok", UUID.randomUUID().toString(), 3600*60);//如果不存在,自定义cookie

    }
    String aaa = HttpUtil.getCookieValue(request , "usercok");
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/149752
推荐阅读
相关标签
  

闽ICP备14008679号