@Override public Long sort(byte[] key, SortParameters params, byte[] storeKey) { Assert.notNull(key, "Key must not be null!"); List<byte[]> sorted = sort(key, params); if (!CollectionUtils.isEmpty(sorted)) { byte[][] arr = new byte[sorted.size()][]; switch (type(key)) { case SET: connection.setCommands().sAdd(storeKey, sorted.toArray(arr)); return 1L; case LIST: connection.listCommands().lPush(storeKey, sorted.toArray(arr)); return 1L; default: throw new IllegalArgumentException("sort and store is only supported for SET and LIST"); } } return 0L; }
@Override public Long sort(byte[] key, SortParameters params, byte[] storeKey) { Assert.notNull(key, "Key must not be null!"); List<byte[]> sorted = sort(key, params); if (!CollectionUtils.isEmpty(sorted)) { byte[][] arr = new byte[sorted.size()][]; switch (type(key)) { case SET: connection.setCommands().sAdd(storeKey, sorted.toArray(arr)); return 1L; case LIST: connection.listCommands().lPush(storeKey, sorted.toArray(arr)); return 1L; default: throw new IllegalArgumentException("sort and store is only supported for SET and LIST"); } } return 0L; }
@Override public Long sort(byte[] key, SortParameters params, byte[] storeKey) { Assert.notNull(key, "Key must not be null!"); List<byte[]> sorted = sort(key, params); if (!CollectionUtils.isEmpty(sorted)) { byte[][] arr = new byte[sorted.size()][]; switch (type(key)) { case SET: connection.setCommands().sAdd(storeKey, sorted.toArray(arr)); return 1L; case LIST: connection.listCommands().lPush(storeKey, sorted.toArray(arr)); return 1L; default: throw new IllegalArgumentException("sort and store is only supported for SET and LIST"); } } return 0L; }