![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
redis
oh my 桂桂
努力当个打工人
展开
-
手写lru算法
public class LRUcache<K,V> extends LinkedHashMap<K,V> { private int size; public LRUcache(int size) { super(size,0.75F,true); this.size = size; } @Override protected boolean removeEldestEntry(Map.Entry<原创 2021-03-01 10:35:26 · 78 阅读 · 0 评论 -
多个key同时被修改
watch+mutil保证同一个key不被多次修改RedisTemplate template = null;//这里配置自己的redis template.watch("key"); template.multi(); template.opsForValue().set("key","value"); List exec = template.exec(); if (null==exec){ Sy原创 2021-02-27 19:31:28 · 89 阅读 · 0 评论 -
Jap测试Redis
@SpringBootTestpublic class RedisTest { @Autowired private RedisTemplate<String, String> redisTemplate; @Autowired private HrRepository hrRepository; @Test public void test() throws JsonProcessingException { //1.从原创 2021-02-27 10:22:11 · 61 阅读 · 0 评论 -
自定义Redis序列化
Json序列化@Configurationpublic class RedisConfig { @Bean @SuppressWarnings("all") public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { RedisTemplate<String, Object> template = new RedisTemplate<Str原创 2021-02-02 18:56:59 · 179 阅读 · 0 评论 -
连接Jedis
1、pom配置<dependencies> <!-- https://mvnrepository.com/artifact/redis.clients/jedis --> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId>原创 2021-02-02 15:34:41 · 111 阅读 · 0 评论