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

Source

@Operator
Obj? get(Str name, |->Obj? defFunc := null)

keys

Source

Str[] keys()

Returns all keys associated / used with this stash

make

Source

new make()

makeFromType

Source

new makeFromType(Type type)

Adds the type name to the locals key - handy for debugging. See IocHelper.locals

set

Source

@Operator
Void set(Str name, Obj? value)

toStr

Source

virtual override Str toStr()