-
Notifications
You must be signed in to change notification settings - Fork 6
Description
This is something I've mentioned here #153 already, but I feel that it's worth to discuss it as a distinct issue.
At the moment, the GarbageCollector acts as a black box. You can collect, and you don't know in advance if it will do something or if it did anything.
This leads to two issues:
- it makes reporting difficult (did the collect method achieved something?)
- you don't know in advance if it will work properly (eg: if you have a large number of records)
Ideally, I think the various types of objects to be collected should be accessible from outside the service (maybe static getters on the login session? or as static methods on the garbage collector itself). This way, you can check how many sessions will be collected before calling ->collect(). This can be useful also to get some idea of the current state of the system (eg: do I have any session waiting to be collected?)
Then, I think that the collect method, instead of returning void, could return some kind of result. In the other issue, I've shown an example where it returns an array with a counter for each method, but it could be a result object. Or, if the signature of the collect method cannot be changed, maybe add a "getResults" method with the results of the latest collect method call.