0

I am using the indexed expire after second ,everything seems fine for me ,but nothing happens after 30 seconds is there more I should do or am I doing something wrong

public class ConfirmationToken {
    @Id
    private String tokenid;

    private String confirmationToken;

    @Field
    @Indexed(name="createdDate", expireAfterSeconds=3600)
    private Date createdDate;

    private Entity user;
    
    public ConfirmationToken() {
    }
    
    public ConfirmationToken(Entity user) {
        this.user = user;
        createdDate = new Date();
        confirmationToken = UUID.randomUUID().toString();
    }




 // Getters and Setter
}

1 Answers1

0

Your TTL index is based on 60 minutes (3600 seconds).

And the documents are casually deleted, which means they won't be deleted at that exact moment. But any time after that when database is not very busy.

Yahya
  • 3,386
  • 3
  • 22
  • 40
  • So you cant set it to like 5 seconds to test if it works, first time doing this –  Jun 19 '21 at 19:35
  • Yes, create an index with the 5 seconds TTL. Test it. And then remove the index to create the correct one with your desired TTL. – Yahya Jun 21 '21 at 09:39