How to increment value of a existing redis hash field using increment()?

55
November 26, 2019, at 12:50 PM

I want to increment the value of a hash which is already present in the Redis. I am using increment() function of a Redis template in following way.

private RedisTemplate redisTemplate;
String subscriptionKey = "sge:subscription:" + subscriber.getSubscriptionUid();
Object fieldKey = new String("deliveredCount");
redisTemplate.opsForHash().increment(subscriptionKey, fieldKey, 1);

Where deliveredCound field is defined in domain class as follows:

@JsonProperty("delivered_count")
    private Integer deliveredCount = 0;

Now the issue is Redis is able to increment the value but it is not able to detect that the field key is already present. As it is not able to find the existing field key, it is creating a new field in Redis.

For example:

What is wrong I am doing here? Appreciate the help :)

READ ALSO
Whats the difference between flex.sm vs flex.md vs fxFlex.lg and fxFlex.gt-lg and so on?

Whats the difference between flex.sm vs flex.md vs fxFlex.lg and fxFlex.gt-lg and so on?

I do understand the terms it stands for, small, medium, large and grater than largeI have read through https://github

29
Website template, text, graphic are distorted when use chrome zoom in

Website template, text, graphic are distorted when use chrome zoom in

My website are distorted when we use chrome to zoom in but no problem in IE and firefox

20
How to make user friendly column headings

How to make user friendly column headings

I am looping through a wordpress database table, it outputs all table columns and data based on a chosen IDIt works as expected, but the downside is that it shows a not-so-user-friendly column heading on the front end

44