0

Does Elasticache store the time when a data is added to the cache? I want to filter data on my cache based on the time it was added but I can't find a clear answer if this information is stored in Elasticache automatically or if I have to add this information (timestamp) manually for each data inserted in the cache?

Thanks!

Tar
  • 185
  • 1
  • 1
  • 16

1 Answers1

0

Neither Redis nor ElastiCache's Redis-compatible service store the timestamp automatically.

This would be inneficient as many use causes don't require it, so it's a client application implementation detail.

You may use a sorted set to store this information, so you can query for date ranges. And you can use Redis server time automatically if you use a Lua script. See How to store in Redis sorted set with server-side timestamp as score?.

This is particularly important if you have multiple nodes connecting, as they may have clock differences.

LeoMurillo
  • 6,048
  • 1
  • 19
  • 34