0

Is there anyway to get expiration time of redis model directly from spring data redis crud?

I have tried this but i can't get expirationTime.

@RedisHash(value = "products")
public class Product {

    @Id
    @Indexed
    private String id;
    private String description;
    private BigDecimal price;
    private String imageUrl;

    @TimeToLive(unit = TimeUnit.MINUTES)
    private Long expirationTime

   //getter setter...
}

it is quote from spring doc : here

Annotating a property explicitly with @TimeToLive reads back the actual TTL or PTTL value from Redis. -1 indicates that the object has no associated expiration.

Why I can't get expiration time? I don't want to use RedisTemplate for this.

sam
  • 1,073
  • 4
  • 13
  • 27

0 Answers0