# Hands-on RedisTemplate

DevFeed: [Hands-on RedisTemplate](<https://devfeed.tech/articles/hands-on-redistemplate-27314.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/201909/redis-template/>)

Published: 2019-09-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [Redis](<https://devfeed.tech/topics/redis.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [API](<https://devfeed.tech/topics/api.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [cache](<https://devfeed.tech/tags/cache.md>), [caching](<https://devfeed.tech/tags/caching.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [redis](<https://devfeed.tech/tags/redis.md>)

## AI overview

A hands-on tutorial explains how to add item-level caching with Spring's RedisTemplate when the existing cache abstraction cannot invalidate individual values within cached collections. It describes introducing a cache abstraction, writing tests, handling JSON serialization, and implementing the Redis-backed service.

## Source excerpt

We are improving cache in the project Im working on. In the code base I've found a method which accepted a collection of ids and returned collection of objects for those ids. My goal was to add cache on individual values returned by the method. Creation of items was IO heavy and time-consuming operation so removal of cache was not an option. Read more