Class RedisItemWriter<K,T>
java.lang.Object
org.springframework.batch.item.KeyValueItemWriter<K,T>
org.springframework.batch.item.redis.RedisItemWriter<K,T>
- All Implemented Interfaces:
ItemWriter<T>,org.springframework.beans.factory.InitializingBean
An ItemWriter implementation for Redis using a RedisTemplate .
- Since:
- 5.1
- Author:
- Santiago Molano, Mahmoud Ben Hassine
-
Field Summary
Fields inherited from class org.springframework.batch.item.KeyValueItemWriter
delete, itemKeyMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidinit()afterPropertiesSet() hookvoidsetRedisTemplate(org.springframework.data.redis.core.RedisTemplate<K, T> redisTemplate) Set theRedisTemplateto use.protected voidwriteKeyValue(K key, T value) Subclasses implement this method to write each item to key value storeMethods inherited from class org.springframework.batch.item.KeyValueItemWriter
afterPropertiesSet, flush, setDelete, setItemKeyMapper, write
-
Constructor Details
-
RedisItemWriter
public RedisItemWriter()
-
-
Method Details
-
writeKeyValue
Description copied from class:KeyValueItemWriterSubclasses implement this method to write each item to key value store- Specified by:
writeKeyValuein classKeyValueItemWriter<K,T> - Parameters:
key- the keyvalue- the item
-
init
protected void init()Description copied from class:KeyValueItemWriterafterPropertiesSet() hook- Specified by:
initin classKeyValueItemWriter<K,T>
-
setRedisTemplate
Set theRedisTemplateto use.- Parameters:
redisTemplate- the template to use
-