Design Hit Counter — a sliding 300-second window
Record each hit's timestamp in order. To count recent hits, count those within the last 300 seconds.
Try:
stored timestamps