private function attach()
{
try {
$this->semaphore = sem_get($this->key);
$this->mutex = new SemaphoreMutex($this->semaphore);
} catch (\InvalidArgumentException $e) {
throw new StorageException("Could not get semaphore id.", 0, $e);
}
$this->memory = shm_attach($this->key, 128);
if (!is_resource($this->memory)) {
throw new StorageException("Failed to attach to shared memory.");
}
}