I’m trying to understand the exact behavior of the expireTime parameter in LeaderboardRecordsList API.
Specifically, I need to know:
- Does it return records before or after the specified timestamp?
- If I want to get last month’s records for a monthly leaderboard reset, what would be the correct expireTime value to use?
Could someone please clarify how this parameter works?
Leaderboards with a reset expression store the scores alongside the respective expiry time, and during that cycle only submitted scores with that expiry time are written and fetched. When the next cycle comes along the new cycle expiry time is used - the expiry time is part of a composite key that uniquely identifies the records in the database - this ensures that all records are kept but only the ones with current cycle expiry time are returned by the APIs.
To fetch previous records you’ll need to know what the expiry time was for them and override it in the listing API - when you list a leaderboard, the previous and next expiryTimes are returned by the API. If you need to go beyond that you may have to calculate the previous resets cron expression expiry times so you can input them in listing.
Hope this helps.
According to the documentation:
Leaderboards with a reset expression store the scores alongside the respective expiry time, and during that cycle only submitted scores with that expiry time are written and fetched. When the next cycle comes along the new cycle expiry time is used - the expiry time is part of a composite key that uniquely identifies the records in the database.
I understand I need to use the correct expiry time to fetch previous records, but:
- How do I calculate the correct expiry time for the previous cycle?
- Is there a way to get the previous cycle’s expiry time programmatically?
- What’s the correct value to pass as the expiry parameter in LeaderboardRecordsList?
Any help would be appreciated!