mirror of https://github.com/elunez/eladmin
去除redis的新增编辑功能
parent
2b931a587f
commit
f9ff6d8657
|
@ -19,8 +19,6 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,22 +29,6 @@ public class RedisController {
|
|||
return new ResponseEntity(redisService.findByKey(key,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增Redis缓存")
|
||||
@PostMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody RedisVo resources){
|
||||
redisService.save(resources);
|
||||
return new ResponseEntity(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改Redis缓存")
|
||||
@PutMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody RedisVo resources){
|
||||
redisService.save(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除Redis缓存")
|
||||
@DeleteMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')")
|
||||
|
|
|
@ -18,12 +18,6 @@ public interface RedisService {
|
|||
*/
|
||||
public Page findByKey(String key, Pageable pageable);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param redisVo
|
||||
*/
|
||||
public void save(RedisVo redisVo);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param key
|
||||
|
|
|
@ -9,8 +9,6 @@ import org.springframework.data.domain.PageImpl;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,6 +29,10 @@ public class RedisServiceImpl implements RedisService {
|
|||
key = "*" + key + "*";
|
||||
}
|
||||
for (Object s : redisTemplate.keys(key)) {
|
||||
// 过滤掉权限的缓存
|
||||
if (s.toString().indexOf("role::loadPermissionByUser") != -1 || s.toString().indexOf("user::loadUserByUsername") != -1) {
|
||||
continue;
|
||||
}
|
||||
RedisVo redisVo = new RedisVo(s.toString(),redisTemplate.opsForValue().get(s.toString()).toString());
|
||||
redisVos.add(redisVo);
|
||||
}
|
||||
|
@ -41,11 +43,6 @@ public class RedisServiceImpl implements RedisService {
|
|||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(RedisVo redisVo) {
|
||||
redisTemplate.opsForValue().set(redisVo.getKey(),redisVo.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String key) {
|
||||
redisTemplate.delete(key);
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -73,13 +73,6 @@
|
|||
</dependency>
|
||||
<!--Spring boot end-->
|
||||
|
||||
<!--jedis-->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>${jedis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--spring2.0集成redis所需common-pool2-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
@ -91,12 +84,6 @@
|
|||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--监控sql日志-->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
|
|
Loading…
Reference in New Issue