Creating a statistic definition for versioning
In the previous example, when creating a statistic definition, there was a hint about the importance of theVersionConfiguration
parameter for versioning. Here, we detail how to use it and how it works.
VersionConfiguration parameter. This parameter allows us to define a
MaxQueryableVersions setting, which specifies how many versions of the same statistic we can query. In this case, we set it to query 12 versions.
The ResetInterval parameter defines how often the reset process occurs. This process involves creating a statistic with the same configuration as
before but without any value, and the version parameter changes as follows: N = N + 1, with N = 0 at the creation of the statistic definition.
For example, let’s we have a statistic with the version parameter equals to two with a given value. Now
we increase the version of that statistic, then the result is going to be a new statistic with the version parameter equals to three without any values.
Meanwhile the previous statistic remains in the system to be query.
The ResetInterval can work in multiple ways. In this example, it’s monthly, but it can be changed according to the developer’s needs. In this particular
case, it means that the leaderboard is going to be reset automatically every month from the moment it was configured. We support the following reset strategies:
- Day
- Hour
- Manual
- Month
- Week
Incrementing the version of a statistic
With this new configuration, we can have multiple versions of the same statistic for different seasons. But what happens if we need to manually reset the leaderboard due to an issue and start over the season? In such cases, we can perform a manual reset using the API. Here’s an example using the SDK:Conclusions
In this tutorial, we learned how to do the following operations:- Create a statistic with the right reset strategy
- Increment the version of a statistic
