@Test public void readWrite() { // monitor commands sent to redis via redis-cli > monitor Car car = new Car(); car.setBrand("Porsche"); Truck truck = new Truck(); truck.setBrand("MAN"); redis.opsForValue().set("v1", car); redis.opsForValue().set("v2", truck); Object v1 = redis.opsForValue().get("v1"); Object v2 = redis.opsForValue().get("v2"); assertThat(v1, is(car)); assertThat(v2, is(truck)); // assertThat(v1, is(instanceOf(Car.class))); // assertThat(v2, is(instanceOf(Truck.class))); }
/** * Constructs a new <code>DefaultRedisSortedSet</code> instance. * * @param key * @param operations * @param defaultScore */ public DefaultRedisZSet(String key, RedisOperations<String, E> operations, double defaultScore) { super(key, operations); boundZSetOps = operations.boundZSetOps(key); this.defaultScore = defaultScore; }