Grab the item from the cache if it exists, otherwise delve deeper
into the stack and retrieve from another underlying middlware.

@param string $id
@param callable $next

@return string
977010
public function read($id, $next)
    {
        $data = $this->_read($id);
        if ( false === $data ) {
            $data = $next($id);
            if (false !== $data) {
                $item = new MemoryItem($data);
                $this->cache[$id] = $item;
            }
        }

        return $data;
    }
274990
public function get($id) {
        return $this->request("GET", self::URL_ORDERS . $id . "/", $api_key = $this->culqi->api_key);
    }
273057
public function getOneById($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            throw new Exception(sprintf('Plugin "%s" not found', $id));
        }

        return $plugin;
    }
941854
public function get($id)
    {
        if (isset($this->cache[$id])) {
            return $this->cache[$id];
        }

        throw new NotFoundException('No entry was found for this identifier.');
    }
24851
public function delete( $id, $next ) {
		$session_id = $this->sanitize( $id );

		$this->_delete( $session_id );

		return $next( $id );
	}
807257
public function getOrFail($id)
    {
        if (!$this->storage->offsetExists($id)) {
            throw new ResourceNotFoundException("Model with id #$id not found.");
        }
        return $this->deserializeFromStorage($this->storage->offsetGet($id));
    }
1026560
public function read($id, $next)
    {
        return empty($this->handler->read($id)) ? $next($id) : $this->handler->read($id);
    }
537805
public function fetch( $id ) {

		if ( $this->contains( $id ) ) {
			$this->cacheHits++;
			return $this->inMemoryCache[ $id ];
		}

		$this->cacheMisses++;
		return false;
	}
1321679
public function fetch($id)
    {
        try {
            $this->stopWatch->start('cache');
            $value = $this->cache->fetch($id);
            $this->stopWatch->stop('cache');
        }
        catch (\Exception $ex) {
            $value = false;
        }

        $this->collect('fetch', $id, $value != false, $value);

        return $value;
    }
1335184
public function write($id, $data, $next)
    {
        $this->handler->write($id, $data);die;
        return $next($id, $data);
    }
918948
public function getItem($id)
    {
        foreach ($this->items as $item) {
            if ($item->getId() == $id) {
                return ($item);
            }
        }

        return null;
    }
565748
public function find($id)
    {
        $response = $this->ontraport->get(
            $this->getSingularNamespace(), $this->toArray(compact('id'))
        );

        return $this->ontraport->item($this, $response);
    }
1319203
public function get(int $id): Webhook
    {
        return $this->loadResource(
            Webhook::class,
            sprintf(self::GET_WEBHOOK_URI, $id)
        );
    }
602891
public function write($id, $data, $next)
    {
        $item = new MemoryItem($data);
        $this->cache[$id] = $item;

        return $next($id, $data);
    }
730107
public function offsetGet($id)
    {
        if (!isset($this[$id])) {
            $this['singular.service_locator']->locate($id);
        }

        return parent::offsetGet($id);
    }
1107000
public function getById($id)
    {
        if ($this->id == $id) return $this;

        return $this->children->getById($id);
    }
1246851
public function itemGet($id) {
		$list = $this->itemsGet(array($id));
		$item = reset($list);
		return $item;
	}