List of usage examples for org.springframework.data.redis.connection RedisConnection lInsert
@Nullable Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value);
From source file:com.mauersu.util.redis.DefaultListOperations.java
public Long leftPush(K key, V pivot, V value) { final byte[] rawKey = rawKey(key); final byte[] rawPivot = rawValue(pivot); final byte[] rawValue = rawValue(value); return execute(new RedisCallback<Long>() { public Long doInRedis(RedisConnection connection) { connection.select(dbIndex);//from w ww. ja v a2 s . c o m return connection.lInsert(rawKey, Position.BEFORE, rawPivot, rawValue); } }, true); }
From source file:com.mauersu.util.redis.DefaultListOperations.java
public Long rightPush(K key, V pivot, V value) { final byte[] rawKey = rawKey(key); final byte[] rawPivot = rawValue(pivot); final byte[] rawValue = rawValue(value); return execute(new RedisCallback<Long>() { public Long doInRedis(RedisConnection connection) { connection.select(dbIndex);// w w w. j av a 2 s . co m return connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue); } }, true); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Insert {@code value} {@link Position#BEFORE} or {@link Position#AFTER} existing {@code pivot} for {@code key}. * <p>/*www .ja v a 2s . co m*/ * See http://redis.io/commands/linsert * * @param key key * @param where where * @param pivot pivot * @param value value * @return Long */ public static Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.lInsert(key, where, pivot, value); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Insert {@code value} {@link Position#BEFORE} or {@link Position#AFTER} existing {@code pivot} for {@code key}. * <p>/*w ww . jav a 2 s.com*/ * See http://redis.io/commands/linsert * * @param key key * @param where where * @param pivot pivot * @param value value * @return Long */ public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.lInsert(key, where, pivot, value); } }); }