I would do something like:

````
$hash = md5(serialize($options));

if (isset($this->containers[$hash])) {
    return $this->containers[$hash];
}

// .. get the container ...

$this->containers[$hash] = $container;

return $this->getContainer($options); // this line basically ensures that the code works without a unit test, as it will either infinite loop or work :)
````