@Override protected RedisEntry retrieveEntry( PersistentEntity persistentEntity, final String family, Serializable key) { final String hashKey = getRedisKey(family, key); final List<String> props = persistentEntity.getPersistentPropertyNames(); final String[] values = redisTemplate.hmget(hashKey, props.toArray(new String[props.size()])); if (entityDoesntExistForValues(values)) return null; RedisEntry entry = new RedisEntry(family); for (int i = 0; i < props.size(); i++) { entry.put(props.get(i), values[i]); } return entry; }
@Override protected void setEntryValue(RedisEntry nativeEntry, String key, Object value) { if (value != null) { nativeEntry.put(key, value.toString()); } }
@Override protected Object getEntryValue(RedisEntry nativeEntry, String property) { return nativeEntry.get(property); }
@Override protected Long storeEntry(PersistentEntity persistentEntity, RedisEntry nativeEntry) { final String family = nativeEntry.getFamily(); Long id = generateIdentifier(family); return performInsertion(family, id, nativeEntry); }