本文整理了Java中org.springframework.data.redis.connection.RedisConnection.get
方法的一些代码示例,展示了RedisConnection.get
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisConnection.get
方法的具体详情如下:
包路径:org.springframework.data.redis.connection.RedisConnection
类名称:RedisConnection
方法名:get
[英]Returns the native connection (the underlying library/driver object).
[中]返回本机连接(底层库/驱动程序对象)。
代码示例来源:origin: spring-projects/spring-data-redis
@Override
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
return connection.get(rawKey);
}
}, true);
代码示例来源:origin: apache/nifi
final byte[] currValue = redisConnection.get(k);
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] get(String name, byte[] key) {
Assert.notNull(name, "Name must not be null!");
Assert.notNull(key, "Key must not be null!");
return execute(name, connection -> connection.get(key));
}
代码示例来源:origin: apache/nifi
final byte[] currValue = redisConnection.get(key);
final RedisStateMap currStateMap = serDe.deserialize(currValue);
final long currVersion = currStateMap == null ? -1L : currStateMap.getVersion();
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] get(byte[] key) {
return convertAndReturn(delegate.get(key), identityConverter);
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public String get(String key) {
return convertAndReturn(delegate.get(serialize(key)), bytesToString);
}
代码示例来源:origin: apache/nifi
@Override
public <K, V> V get(final K key, final Serializer<K> keySerializer, final Deserializer<V> valueDeserializer) throws IOException {
return withConnection(redisConnection -> {
final byte[] k = serialize(key, keySerializer);
final byte[] v = redisConnection.get(k);
return valueDeserializer.deserialize(v);
});
}
代码示例来源:origin: spring-projects/spring-security-oauth
@Override
public OAuth2Authentication readAuthentication(String token) {
byte[] bytes = null;
RedisConnection conn = getConnection();
try {
bytes = conn.get(serializeKey(AUTH + token));
} finally {
conn.close();
}
OAuth2Authentication auth = deserializeAuthentication(bytes);
return auth;
}
代码示例来源:origin: spring-projects/spring-security-oauth
public OAuth2Authentication readAuthenticationForRefreshToken(String token) {
RedisConnection conn = getConnection();
try {
byte[] bytes = conn.get(serializeKey(REFRESH_AUTH + token));
OAuth2Authentication auth = deserializeAuthentication(bytes);
return auth;
} finally {
conn.close();
}
}
代码示例来源:origin: spring-projects/spring-security-oauth
@Override
public OAuth2AccessToken readAccessToken(String tokenValue) {
byte[] key = serializeKey(ACCESS + tokenValue);
byte[] bytes = null;
RedisConnection conn = getConnection();
try {
bytes = conn.get(key);
} finally {
conn.close();
}
OAuth2AccessToken accessToken = deserializeAccessToken(bytes);
return accessToken;
}
代码示例来源:origin: spring-projects/spring-security-oauth
@Override
public OAuth2RefreshToken readRefreshToken(String tokenValue) {
byte[] key = serializeKey(REFRESH + tokenValue);
byte[] bytes = null;
RedisConnection conn = getConnection();
try {
bytes = conn.get(key);
} finally {
conn.close();
}
OAuth2RefreshToken refreshToken = deserializeRefreshToken(bytes);
return refreshToken;
}
代码示例来源:origin: apache/nifi
@Override
public <K, V> AtomicCacheEntry<K, V, byte[]> fetch(final K key, final Serializer<K> keySerializer, final Deserializer<V> valueDeserializer) throws IOException {
return withConnection(redisConnection -> {
final byte[] k = serialize(key, keySerializer);
final byte[] v = redisConnection.get(k);
if (v == null) {
return null;
}
// for Redis we are going to use the raw bytes of the value as the revision
return new AtomicCacheEntry<>(key, valueDeserializer.deserialize(v), v);
});
}
代码示例来源:origin: apache/nifi
@Override
public StateMap getState(final String componentId) throws IOException {
return withConnection(redisConnection -> {
final byte[] key = getComponentKey(componentId).getBytes(StandardCharsets.UTF_8);
final byte[] value = redisConnection.get(key);
final RedisStateMap stateMap = serDe.deserialize(value);
if (stateMap == null) {
return new RedisStateMap.Builder().encodingVersion(ENCODING_VERSION).build();
} else {
return stateMap;
}
});
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Duration ttl) {
Assert.notNull(name, "Name must not be null!");
Assert.notNull(key, "Key must not be null!");
Assert.notNull(value, "Value must not be null!");
return execute(name, connection -> {
if (isLockingCacheWriter()) {
doLock(name, connection);
}
try {
if (connection.setNX(key, value)) {
if (shouldExpireWithin(ttl)) {
connection.pExpire(key, ttl.toMillis());
}
return null;
}
return connection.get(key);
} finally {
if (isLockingCacheWriter()) {
doUnlock(name, connection);
}
}
});
}
代码示例来源:origin: spring-projects/spring-security-oauth
private void removeAccessTokenUsingRefreshToken(String refreshToken) {
byte[] key = serializeKey(REFRESH_TO_ACCESS + refreshToken);
List<Object> results = null;
RedisConnection conn = getConnection();
try {
conn.openPipeline();
conn.get(key);
conn.del(key);
results = conn.closePipeline();
} finally {
conn.close();
}
if (results == null) {
return;
}
byte[] bytes = (byte[]) results.get(0);
String accessToken = deserializeString(bytes);
if (accessToken != null) {
removeAccessToken(accessToken);
}
}
代码示例来源:origin: apache/nifi
final byte[] existingValue = redisConnection.get(kv.getKey());
代码示例来源:origin: spring-projects/spring-security-oauth
@Override
public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) {
String key = authenticationKeyGenerator.extractKey(authentication);
byte[] serializedKey = serializeKey(AUTH_TO_ACCESS + key);
byte[] bytes = null;
RedisConnection conn = getConnection();
try {
bytes = conn.get(serializedKey);
} finally {
conn.close();
}
OAuth2AccessToken accessToken = deserializeAccessToken(bytes);
if (accessToken != null) {
OAuth2Authentication storedAuthentication = readAuthentication(accessToken.getValue());
if ((storedAuthentication == null || !key.equals(authenticationKeyGenerator.extractKey(storedAuthentication)))) {
// Keep the stores consistent (maybe the same user is
// represented by this authentication but the details have
// changed)
storeAccessToken(accessToken, authentication);
}
}
return accessToken;
}
代码示例来源:origin: spring-projects/spring-security-oauth
try {
conn.openPipeline();
conn.get(accessKey);
conn.get(authKey);
conn.del(accessKey);
conn.del(accessToRefreshKey);
代码示例来源:origin: bill1012/AdminEAP
public byte[] doInRedis(RedisConnection connection)
throws DataAccessException {
RedisSerializer<String> serializer = getRedisSerializer();
byte[] keyStr = serializer.serialize(key);
byte[] value = connection.get(keyStr);
return value;
}
});
代码示例来源:origin: bill1012/AdminEAP
public T doInRedis(RedisConnection connection)
throws DataAccessException {
RedisSerializer<String> serializer = getRedisSerializer();
byte[] keyStr = serializer.serialize(key);
byte[] value = connection.get(keyStr);
if (value == null) {
return null;
}
String valueStr = serializer.deserialize(value);
return (T) JSON.parseObject(valueStr, clazz);
}
});
内容来源于网络,如有侵权,请联系作者删除!