1.redisTemplate类所在的包路径:
org.springframework.data.redis.core.RedisTemplate
2.redisTemplate序列化,需要序列化四个地方,keySerializer, valueSerializer,hashKeySerializer,hashValueSerializer:
@Nullable
private RedisSerializer keySerializer = null;
@Nullable
private RedisSerializer valueSerializer = null;
@Nullable
private RedisSerializer hashKeySerializer = null;
@Nullable
private RedisSerializer hashValueSerializer = null;
3.RedisTemplate可以通过什么方法返回什么对象对数据进行操作?
3.1.常用的获取操作数据的对象方法,opsForValue(),opsForHash(),opsForList(),opsForSet(),opsForZSet(),opsForStream(),opsForGeo(),如下:
3.2.返回的操作对象类型:ValueOperations,ListOperations,SetOperations,StreamOperations,ZSetOperations,GeoOperations,HyperLogLogOperations,ClusterOperations。如下:
private final ValueOperations<K, V> valueOps = new DefaultValueOperations(this);
private final ListOperations<K, V> listOps = new DefaultListOperations(this);
private final SetOperations<K, V> setOps = new DefaultSetOperations(this);
private final StreamOperations<K, ?, ?> streamOps = new DefaultStreamOperations(this, ObjectHashMApper.getSharedInstance());
private final ZSetOperations<K, V> zSetOps = new DefaultZSetOperations(this);
private final GeoOperations<K, V> geoOps = new DefaultGeoOperations(this);
private final HyperLogLogOperations<K, V> hllOps = new DefaultHyperLogLogOperations(this);
private final ClusterOperations<K, V> clusterOps = new DefaultClusterOperations(this);
4.ValueOperations的常用方法
5.ListOperations的常用方法
6.SetOperations的常用方法
7.StreamOperations的常用方法
8.ZSetOperations的常用方法
9.GeoOperations的常用方法
10.HyperLogLogOperations的常用方法
11.ClusterOperations的常用方法