skip to Main Content

How to mock HashOperations of Spring StringRedisTemplate?

I'm writing unit test for my CacheService class: public class CacheService { private final HashOperations<String, String, String> redisHashOps; private final ValueOperations<String, String> valueOps; private final SetOperations<String, String> setOps; public CacheService(StringRedisTemplate redisTemplate) { this.redisHashOps = redisTemplate.opsForHash(); this.valueOps = redisTemplate.opsForValue(); this.setOps =…

VIEW QUESTION

Error when importing Redis client into Typescript app

When importing the npm Redis module into a TypeScript application, I receive the error: node_modules/@node-redis/client/dist/lib/client/index.d.ts:45:78 - error TS1256: A rest element must be last in a tuple type. 45 export declare type ClientLegacyCommandArguments = LegacyCommandArguments | [...LegacyCommandArguments, ClientLegacyCallback]; The error…

VIEW QUESTION

Handle redis connection reset

We are facing [Errno 54] Connection reset by peer at very random in our application and looks like it is being triggered by redis server than client. Python's redis client have backoff strategy implementation but it's unable to handle this…

VIEW QUESTION

Spring Boot Redis Cache remove cache with multiple key

I have a method that saves cache. @GetMapping("/orders") @Cacheable(value = "List<Order>", key = "{#customerName+'s orders', #page, #size}") public List<Order> findOrders(@RequestParam("customerName") String customerName, @RequestParam(name = "page") int page, @RequestParam(name = "size") int size) { ... And I want to remove this…

VIEW QUESTION
Back To Top
Search