Consumption License
Licenses of type consumption allow you to use a limited or unlimited number of consumable units, which can be applied based on your application’s needs. For example,
Our SDK provides a simple two-step process for managing consumptions:
UpdateConsumption
This method updates the LocalConsumptions value in the local license file, if the value alligns with license's specifications.
ld, err = lh.UpdateConsumption(1)
t := ld.TotalConsumptions
l := ld.LocalConsumptions
fmt.Printf("Total Consumptions: %d\n Local Consumptions: %d\n", t, l)SyncConsumption
This method synchronizes the current LocalConsumptions value with the LicenseSpring cloud server. If the sync is successful and no errors are returned, the local license file is updated as follows:
TotalConsumptionsis incremented (or decremented) based on the local value.LocalConsumptionsis reset to zero.
This update will also be visible on the LicenseSpring platform dashboard.
SyncConsumption also can request the server to allow overages. The second argument is whether to ask for overages and the third is the number of overages requested, if any.
If overages requested, the change will be reflected both in local license file and platform.
Was this helpful?