高效Java后台程序缓存用户信息的研究  被引量:3

Research on the Efficient Caching of User Information in Java

在线阅读下载全文

作  者:白晓涛 陶智勇[1] BAI Xiaotao;TAO Zhiyong(Wuhan Rearch Institude of Posts and Telecommunications,Wuhan 430074,China)

机构地区:[1]武汉邮电科学研究院,武汉430074

出  处:《网络新媒体技术》2020年第5期35-38,共4页Network New Media Technology

基  金:湖北农村地区宽带建设及信息服务发展策略研究项目编号:D20143005。

摘  要:在Java Web开发中,当用户经过权限验证后,用户信息一般保存到Redis,Ehcache等缓存中。但后台逻辑代码在获取用户信息时还需要从缓存中获取,并进行格式转换,这样速度很慢,且代码复杂冗余。为了优化业务代码在获取用户信息时的效率问题和操作冗余问题,本文总结并完善了当前开发中最高效的两种缓存用户信息的方式,HttpServletRequest和ThreadLocal。这两种方式直接将用户信息以对象方法保存到内存中,获取快速且不需要类型转换,比缓存方式效率更高。本文深入探索了这两种方式的实现原理和底层结构,并从时间复杂度,实现难度,编程思想,扩展性等方面进行了详细比较。In Java Web development,user information is usually saved to Redis,Ehcache and other caches when the user has been authorized.So the background program needs to get user information from the cache and convert the type.This is slow,and the code is complex and redundant.In order to optimize the efficiency and redundancy of business code in obtaining user information,the paper summarizes and improves two most efficient ways of caching user information in current development,and they are HttpServletRequest and ThreadLocal.These two methods directly store user information in memory,and obtain it quickly without type conversion,which are more efficient than caching method.This paper studies the principle and the underlying structure of two methods.And the two methods are compared from the aspects of time complexity,implementation difficulty,programming idea,scalability,etc.

关 键 词:缓存 用户信息 HttpServletRequest ThreadLocal 

分 类 号:TP312.2[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象