Skip to content

Commit 42b1764

Browse files
committed
Return cached HashOperations instance from opsForHash.
Closes #2970
1 parent 7dd8b8e commit 42b1764

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/springframework/data/redis/core/RedisTemplate.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
116116
ObjectHashMapper.getSharedInstance());
117117
private final ZSetOperations<K, V> zSetOps = new DefaultZSetOperations<>(this);
118118
private final GeoOperations<K, V> geoOps = new DefaultGeoOperations<>(this);
119+
private final HashOperations<K, ?, ?> hashOps = new DefaultHashOperations<>(this);
119120
private final HyperLogLogOperations<K, V> hllOps = new DefaultHyperLogLogOperations<>(this);
120121
private final ClusterOperations<K, V> clusterOps = new DefaultClusterOperations<>(this);
121122

@@ -977,7 +978,7 @@ public <HK, HV> BoundHashOperations<K, HK, HV> boundHashOps(K key) {
977978

978979
@Override
979980
public <HK, HV> HashOperations<K, HK, HV> opsForHash() {
980-
return new DefaultHashOperations<>(this);
981+
return (HashOperations) hashOps;
981982
}
982983

983984
@Override

0 commit comments

Comments
 (0)