In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Engineering construction:
(1) introduction: redis can be operated not only with commands, but also with client support in basically mainstream languages, such as java, C, C #, C++, php, Node.js, Go and so on.
Jedis is introduced here, address: https://github.com/xetorthio/jedis
(2) dependence:
If it is an ordinary project created: you need to add the jar package of the corresponding jedis.jar to the project.
If you are using maven, import the dependent dependency directly: https://mvnrepository.com/artifact/redis.clients/jedis
Redis.clients
Jedis
3.0.0
2.API
(1) single instance connects to redis
Public class JedisUtils {public void jedisClient () {/ * new Jedis (pars1,pars2); * pars1:hostname:String * port:int * / Jedis jedis=new Jedis ("hadoop03", 6379); / / assign jedis.set ("name", "zs") through redis; / / get the value String name=jedis.get ("name") through redis / / release resource jedis.close ();}}
(2) use jedis connection pool to connect to redis service
Public void jedisPoolClient () {/ * new JedisPool (pars1,pars2); * pars1:String, which can be written to a cluster such as redis01,redis03... * port:int port * / JedisPool pool=new JedisPool ("hadoop03", 6379); / obtain Jedis instance Jedis jedis=pool.getResource (); / / release resource jedis.close (); pool.close ();}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.