Skip to content

Container – Extending

Bartosz Łaniewski edited this page Mar 28, 2018 · 1 revision

You can create your own containers and integrate them with Inra modules as long as they implement the ContainerInterface, or just extend the default Container class:

class MyContainer extends Container implements ContainerInterface {
  cache: new Cache();

  set(key: string, value: any): any {
    return this.cache.set(key);
  }

  get(key: string, defaultValue: any): any {
    return this.cache.get(key) || defaultValue;
  }
}