title: Retrieve TTL of POJO stored using spring redis repository
body: <p>I'm using a Spring redis repository for my project to persist a POJO into redis. Following example details what I'm trying to achieve.</p>
  
  <pre><code>@Data
  @RedisHash("Example")
  public class Example {
      @Id
      private String id;
      private String attributeA;
      private String attirbuteB;
  
      @TimeToLive(unit = TimeUnit.SECONDS)
      private Long timeToLive;
  }
  </code></pre>
  
  <p>The repository for above POJO looks as shown below.</p>
  
  <pre><code>public interface ExampleRepository extends CrudRepository&lt;Example, String&gt; {
  
  }
  </code></pre>
  
  <p>@TimeToLive works fine in setting the expiry into redis. In my code, I tried setting the value of timeToLive = 1200. The code goes as below...</p>
  
  <pre><code>Example example = new Example();
  example.setId("abc");
  example.setTimeToLive(1200L);
  exampleRepository.save(example);
  </code></pre>
  
  <p>My problem starts when I attempt to retrieve the POJO from redis. </p>
  
  <pre><code>Example example = exampleRepository.findOne(id);
  System.out.println(example.getTimeToLive());
  </code></pre>
  
  <p>Above code always prints 1200 as the output. From the CLI I can confirm that the TTL for object existing in redis is reducing as time passes. Yet, it is not set to the POJO I'm trying to retrieve.</p>
  
  <p>Why am I not able to retrieve the current value of ttl set in redis for this POJO instance? </p>
  
  <p>Is there an alternate way of achieving this using spring redis repository!</p>
  
  <p>Thanks in advance!</p>