@Test public void select_with_limit() throws Exception { BasicUser user = RandomData.randomUser(); requeryOperations.insert(user); Result<BasicUser> result = requeryOperations .select(BasicUser.class, BasicUser.ID, BasicUser.NAME) .limit(10) .get(); BasicUser first = result.first(); assertThat(first.getId()).isEqualTo(user.getId()); assertThat(first.getName()).isEqualTo(user.getName()); assertThat(first.getAge()).isEqualTo(user.getAge()); Result<BasicUser> result2 = requeryOperations .select(BasicUser.class, BasicUser.ID, BasicUser.NAME) .limit(10) .get(); BasicUser first2 = result.first(); assertThat(first2.getId()).isEqualTo(user.getId()); assertThat(first2.getName()).isEqualTo(user.getName()); assertThat(first2.getAge()).isEqualTo(user.getAge()); }
@Override public <T> T get(Class<T> type, Object key) { log.trace("Load cache entity from redis. type={}, key={}", type, key); RMapCache cache = getCache(type); RedisSerializedEntity container = (RedisSerializedEntity) cache.get(key); return (container != null) ? type.cast(container.getEntity()) : null; }
RedisEntityCache implements EntityCache { @Override public <T> T get(Class<T> type, Object key) { log.trace("Load cache entity from redis. type={}, key={}", type, key); RMapCache cache = getCache(type); RedisSerializedEntity container = (RedisSerializedEntity) cache.get(key); return (container != null) ? type.cast(container.getEntity()) : null; } }
RedisEntityCache implements EntityCache { @Override public <T> T get(Class<T> type, Object key) { log.trace("Load cache entity from redis. type={}, key={}", type, key); RMapCache cache = getCache(type); RedisSerializedEntity container = (RedisSerializedEntity) cache.get(key); return (container != null) ? type.cast(container.getEntity()) : null; } RedisEntityCache(@Nonnull final EntityModel model, @Nonnull final RedissonClient redisson); }
RedisEntityCache implements EntityCache { @Override public <T> T get(Class<T> type, Object key) { log.trace("Load cache entity from redis. type={}, key={}", type, key); RMapCache cache = getCache(type); RedisSerializedEntity container = (RedisSerializedEntity) cache.get(key); return (container != null) ? type.cast(container.getEntity()) : null; } RedisEntityCache(@Nonnull final EntityModel model, @Nonnull final RedissonClient redisson); @Override T get(Class<T> type, Object key); @SuppressWarnings("unchecked") @Override void put(Class<T> type, Object key, T value); @Override boolean contains(Class<?> type, Object key); @Override void invalidate(Class<?> type); @Override void invalidate(Class<?> type, Object key); @Override void clear(); }
RedisEntityCache implements EntityCache { @Override public <T> T get(Class<T> type, Object key) { log.trace("Load cache entity from redis. type={}, key={}", type, key); RMapCache cache = getCache(type); RedisSerializedEntity container = (RedisSerializedEntity) cache.get(key); return (container != null) ? type.cast(container.getEntity()) : null; } RedisEntityCache(@Nonnull final EntityModel model, @Nonnull final RedissonClient redisson); @Override T get(Class<T> type, Object key); @SuppressWarnings("unchecked") @Override void put(Class<T> type, Object key, T value); @Override boolean contains(Class<?> type, Object key); @Override void invalidate(Class<?> type); @Override void invalidate(Class<?> type, Object key); @Override void clear();  }