Open apatrida opened 9 years ago
I'm writing it here because it can be a part of it.
For testing purposes, or for RAM purposes, add a clear()
method that clears all the data. I've got a problem with existing data in my tests (I Inject stubs to check if the classes works as intended).
For testing you can create your own scope, and drop it to clear memory.
in the @Before method, ...
Injekt = InjektScope(DefaultRegistrar())
Will replace the global scope with a new one each time. It is defined as:
public @Volatile var Injekt: InjektScope = InjektScope(DefaultRegistrar())
so can be reset. I can also add clear methods (clearValues()
, clearFactories()
, ?)
Yes, I've done doing that and then I saw this post :)
I'll add clear methods in future release
let me know if priority should be higher than "soon...."
No, it is OK. Currently I need it only for testing, and I've created a base InjektableTest
class.
If an instance is useless (i.e. an ElasticSearch Client connection is dead) or known to be done, it should be able to be expired from the registry. This is important for PerKey factories that generate items and hold on to them, and eventually they need to be removed if the set is not finite.