使用 Redis 官方推薦的 Jedis,在 java 應(yīng)用中操作 Redis。Jedis 幾乎涵蓋了 Redis 的所有命令。操作 Redis 的命令在 Jedis 中以方法的形式出現(xiàn)。jedis 完全兼容 redis 2.8.x and 3.x.x
● Jedis 源碼:https://github.com/xetorthio/jedis
● api 文檔:http://xetorthio.github.io/jedis/
● 下載:http://search.maven.org/ ,搜索 jedis
瀏覽器打開(kāi):http://search.maven.org/ ,搜索 jedis。在 Download 處,點(diǎn)擊 jar
最新的版本 jedis-2.9.0
Jedis 對(duì)象并不是線程安全的,在多線程下使用同一個(gè) Jedis 對(duì)象會(huì)出現(xiàn)并發(fā)問(wèn)題。為了避免每次使用 Jedis 對(duì)象時(shí)都需要重新構(gòu)建,Jedis 提供了 JedisPool。JedisPool 是基于Commons Pool 2 實(shí)現(xiàn)的一個(gè)線程安全的連接池
瀏覽器打開(kāi):http://search.maven.org/ ,搜索 commons-pool2。在 Download 處,點(diǎn)擊 jar
點(diǎn)擊