const classafIoc::LocalStash
sys::Obj afIoc::LocalStash
A wrapper around Actor.locals ensuring a unique namespace per instance. this means you don't have to worry about name clashes.
Example usage:
stash1 := LocalStash() stash1["wot"] = "ever" stash2 := LocalStash() stash2["wot"] = "banana" Obj.echo(stash1["wot"]) // --> ever
Though typically you would create calculated field wrappers:
const class Example private const LocalStash stash := LocalStash(typeof) MyService wotever { get { stash["wotever"] } set { stash["wotever"] = it } } }
- get
- keys
Str[] keys()
Returns all keys associated / used with this stash
- make
new make()
- makeFromType
new makeFromType(Type type)
Adds the type name to the
locals
key - handy for debugging. See IocHelper.locals- set
- toStr
virtual override Str toStr()