[写在前面]:基于网上程序改编,如果存在bug,请自行修改!不喜勿喷!
开发工具:eclipse
开发环境:jdk 1.6
访问URL:http://localhost:8080/redis-admin
tips:这是个maven 项目,不会玩maven项目的同学,慎重下载!建议有maven基础的同学下载学习。
Java-Redis-Admin客户端是bootstrap风格,下面先看看图片:
下载的同学们,需要注意几个地方
1.找到下载代码里面 redis.properties 文件,修改为你的成你的host,name,port,password
password有就写,没有就注释掉。
num这个看你要连接几个redis了,如果是连接一个就1
如下redis.server.num=1
redis.language=English
#must set a default-name redis
redis.host.1=192.168.1.136
redis.name.1=192.168.1.136
redis.port.1=6379
#redis.host.2=10.100.142.16
#redis.name.2=10.100.142.16
#redis.port.2=6379
#redis.password.2=qwe12312
2.登录验证用了Spring security实现,具体实现代码如下
这里用到了application.properties 文件,这个文件里面保存了用户名和密码。
可以到这个文件里面随意改成你想要的用户名和密码。/**
*
* 登录验证
*
* @author luoy
*
*/
@Configuration
@EnableWebSecurity
public class Security extends WebSecurityConfigurerAdapter {
@Autowired
Environment env;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser(env.getProperty("manager.username", "root"))
.password(env.getProperty("manager.password", "password"))
.roles("USER");
}
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()// 禁止跨站请求 Cross-site request forgery
.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic();
}
}
最后说两句
java-redis-admin客户端事先把reids缓存数据查询出来,然后保存在了内存中,然后做数据的展示,分页。
对于数据的刷新,提供了自动刷新和手动刷新,建议使用的时候启用 自动刷新模式,这样对数据操作后,会及时的展示出来,而手动刷新需要人工手动刷新了才会对数据进行刷新。
特此新增了一个功能,一键删除。使用这个功能 会把redis库里面所有的缓存数据清空,so 慎用这个功能。
对了,下载代码 你会发现,除了web.xml 你是看不见其他的配置文件的,如果你想知道,想学习,就看我的文(bi)字(bi)后,点击下载吧!
我是 最代码伊成(可以点击关注我~)
我的企鹅:792435323