// NewService returns a new expiry Service.
// interval is how frequently this service will check for (and delete as needed) expired data. Shorter intervals will
// remove expired data sooner at the expense of increased resource usage. Each Orb instance within a cluster should
// have the same interval configured in order for this service to work efficiently.
// coordinationStore is used for ensuring that only one Orb instance within a cluster has the duty of performing
// expired data cleanup (in order to avoid every instance doing the same work, which is wasteful). Every Orb instance
// within the cluster needs to be connected to the same database for it to work correctly. Note that when initializing
// Orb servers (or if the Orb server with the duty goes down) it is possible for multiple Orb instances to briefly
// assign themselves the duty, but only for one round. This will automatically be resolved on
// the next check and only one will end up with the duty from that point on. This situation is not of concern since
// it's safe for two instances to perform the check at the same time.
// instanceID is used in the coordinationStore for determining who currently has the duty of doing the expired data
// cleanup. It must be unique for every Orb instance within the cluster in order for this service to work efficiently.
// You must register each store you want this service to run on using the Register method. Once all your stores are
// registered, call the Start method to start the service.
NewService returns a new expiry Service.
interval is how frequently this service will check for (and delete as needed) expired data. Shorter intervals will
remove expired data sooner at the expense of increased resource usage. Each Orb instance within a cluster should
have the same interval configured in order for this service to work efficiently.
coordinationStore is used for ensuring that only one Orb instance within a cluster has the duty of performing
expired data cleanup (in order to avoid every instance doing the same work, which is wasteful). Every Orb instance
within the cluster needs to be connected to the same database for it to work correctly. Note that when initializing
Orb servers (or if the Orb server with the duty goes down) it is possible for multiple Orb instances to briefly
assign themselves the duty, but only for one round. This will automatically be resolved on
the next check and only one will end up with the duty from that point on. This situation is not of concern since
it's safe for two instances to perform the check at the same time.
instanceID is used in the coordinationStore for determining who currently has the duty of doing the expired data
cleanup. It must be unique for every Orb instance within the cluster in order for this service to work efficiently.
You must register each store you want this service to run on using the Register method. Once all your stores are
registered, call the Start method to start the service.
// NewService returns a new expiry Service . // interval is how frequently this service will check for ( and delete as needed ) expired data . Shorter intervals will // remove expired data sooner at the expense of increased resource usage . Each Orb instance within a cluster should // have the same interval configured in order for this service to work efficiently . // coordinationStore is used for ensuring that only one Orb instance within a cluster has the duty of performing // expired data cleanup ( in order to avoid every instance doing the same work which is wasteful ) . Every Orb instance // within the cluster needs to be connected to the same database for it to work correctly . Note that when initializing // Orb servers ( or if the Orb server with the duty goes down ) it is possible for multiple Orb instances to briefly // assign themselves the duty but only for one round . This will automatically be resolved on // the next check and only one will end up with the duty from that point on . This situation is not of concern since // it ' s safe for two instances to perform the check at the same time . // instanceID is used in the coordinationStore for determining who currently has the duty of doing the expired data // cleanup . It must be unique for every Orb instance within the cluster in order for this service to work efficiently . // You must register each store you want this service to run on using the Register method . Once all your stores are // registered call the Start method to start the service .
func NewService(scheduler taskManager, interval time.Duration) *Service {
	s := &Service{
		logger: log.New(loggerModule),
	}
	scheduler.RegisterTask(taskName, interval, s.deleteExpiredData)
	return s
}
func NewService ( scheduler taskManager , interval time . Duration ) * Service { s := & Service { logger : log . New ( loggerModule ) , } scheduler . RegisterTask ( taskName , interval , s . deleteExpiredData ) return s }
NewService returns a new expiry Service.
NewService returns a new expiry Service .