src/NcrRequestInterceptor.php
public function enrichGetNodeRequest(PbjxEvent $pbjxEvent): void
    {
        $request = $pbjxEvent->getMessage();
        if ($request->has('node_ref')
            || $request->get('consistent_read')
            || !$request->has('qname')
            || !$request->has('slug')
        ) {
            return;
        }

        $qname = SchemaQName::fromString($request->get('qname'));
        $cacheKey = $this->getSlugCacheKey($qname, $request->get('slug'));

        $cacheItem = $this->cache->getItem($cacheKey);
        if (!$cacheItem->isHit()) {
            $this->cacheItems[$cacheKey] = $cacheItem;
            return;
        }

        try {
            $nodeRef = NodeRef::fromString($cacheItem->get());
            if ($nodeRef->getQName() === $qname) {
                $request->set('node_ref', $nodeRef);
            }
        } catch (\Throwable $e) {
        }
    }
public function enrichGetNodeRequest(PbjxEvent $pbjxEvent): void
    {
        $request = $pbjxEvent->getMessage();
        if ($request->has('node_ref')
            || $request->get('consistent_read')
            || !$request->has('qname')
            || !$request->has('slug')
        ) {
            return;
        }

        $qname = SchemaQName::fromString($request->get('qname'));
        $cacheKey = $this->getSlugCacheKey($qname, $request->get('slug'));

        $cacheItem = $this->cache->getItem($cacheKey);
        if (!$cacheItem->isHit()) {
            $this->cacheItems[$cacheKey] = $cacheItem;
            return;
        }

        try {
            $nodeRef = NodeRef::fromString($cacheItem->get());
            if ($nodeRef->getQName() === $qname) {
                $request->set('node_ref', $nodeRef);
            }
        } catch (\Throwable $e) {
        }
    }
public function enrichGetNodeRequest ( PbjxEvent $ pbjxEvent ) : void { $ request = $ pbjxEvent -> getMessage ( ) ; if ( $ request -> has ( 'node_ref' ) || $ request -> get ( 'consistent_read' ) || ! $ request -> has ( 'qname' ) || ! $ request -> has ( 'slug' ) ) { return ; } $ qname = SchemaQName :: fromString ( $ request -> get ( 'qname' ) ) ; $ cacheKey = $ this -> getSlugCacheKey ( $ qname , $ request -> get ( 'slug' ) ) ; $ cacheItem = $ this -> cache -> getItem ( $ cacheKey ) ; if ( ! $ cacheItem -> isHit ( ) ) { $ this -> cacheItems [ $ cacheKey ] = $ cacheItem ; return ; } try { $ nodeRef = NodeRef :: fromString ( $ cacheItem -> get ( ) ) ; if ( $ nodeRef -> getQName ( ) === $ qname ) { $ request -> set ( 'node_ref' , $ nodeRef ) ; } } catch ( \ Throwable $ e ) { } }
Enrich the request with a node_ref if possible to minimize
the number of lookups against the slug secondary index.

@param PbjxEvent $pbjxEvent
Enrich the request with a node_ref if possible to minimize the number of lookups against the slug secondary index .