package com.izouma.nineth;

import com.izouma.nineth.config.RedisKeys;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;

public class RedisTest extends ApplicationTests {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @Test
    public void testHash() {
        BoundHashOperations<String, Object, Object> operations = redisTemplate.boundHashOps(RedisKeys.DRAW_BLIND_BOX + "111");
        System.out.println(operations.entries());
        operations.putIfAbsent("1", "1");
        operations.putIfAbsent("1", "2");
        System.out.println(operations.entries());
        System.out.println(operations.get("111"));
    }

}
