JDBCConnectionPool connectionPool = new JDBCConnectionPool("redis://localhost:6379", "username", "password"); Connection connection = connectionPool.getConnection(); Statement statement = connection.createStatement(); statement.addBatch("INSERT INTO users (name) VALUES ('Alice')"); statement.addBatch("INSERT INTO users (name) VALUES ('Bob')"); statement.executeBatch(); import com.fasterxml.jackson.databind.ObjectMapper; ObjectMapper objectMapper = new ObjectMapper(); String json = objectMapper.writeValueAsString(user); connection.setCompression(CompressionAlgorithm.SNAPPY); import redis.clients.jedis.Jedis; Jedis jedis = new Jedis("localhost"); jedis.set("user:1", "Alice");


上一篇:
下一篇:
切换中文