public function storeRecord($currentTime, Record $record)
    {
        $id = $this->serializeRecordToIdentity($record);

        $cache = $this->cache;

        $this->cache
            ->get($id)
            ->then(
                function ($value) {
                    if ($value === null) {
                        // cache 0.5+ cache miss resolves with null, return empty bag here
                        return new RecordBag();
                    }

                    // reuse existing bag on cache hit to append new record to it
                    return unserialize($value);
                },
                function ($e) {
                    // legacy cache < 0.5 cache miss rejects promise, return empty bag here
                    return new RecordBag();
                }
            )
            ->then(function (RecordBag $recordBag) use ($id, $currentTime, $record, $cache) {
                // add a record to the existing (possibly empty) record bag and save to cache
                $recordBag->set($currentTime, $record);
                $cache->set($id, serialize($recordBag));
            });
    }
public function storeRecord($currentTime, Record $record)
    {
        $id = $this->serializeRecordToIdentity($record);

        $cache = $this->cache;

        $this->cache
            ->get($id)
            ->then(
                function ($value) {
                    if ($value === null) {
                        // cache 0.5+ cache miss resolves with null, return empty bag here
                        return new RecordBag();
                    }

                    // reuse existing bag on cache hit to append new record to it
                    return unserialize($value);
                },
                function ($e) {
                    // legacy cache < 0.5 cache miss rejects promise, return empty bag here
                    return new RecordBag();
                }
            )
            ->then(function (RecordBag $recordBag) use ($id, $currentTime, $record, $cache) {
                // add a record to the existing (possibly empty) record bag and save to cache
                $recordBag->set($currentTime, $record);
                $cache->set($id, serialize($recordBag));
            });
    }
public function storeRecord ( $ currentTime , Record $ record ) { $ id = $ this -> serializeRecordToIdentity ( $ record ) ; $ cache = $ this -> cache ; $ this -> cache -> get ( $ id ) -> then ( function ( $ value ) { if ( $ value === null ) { // cache 0.5+ cache miss resolves with null, return empty bag here return new RecordBag ( ) ; } // reuse existing bag on cache hit to append new record to it return unserialize ( $ value ) ; } , function ( $ e ) { // legacy cache < 0.5 cache miss rejects promise, return empty bag here return new RecordBag ( ) ; } ) -> then ( function ( RecordBag $ recordBag ) use ( $ id , $ currentTime , $ record , $ cache ) { // add a record to the existing (possibly empty) record bag and save to cache $ recordBag -> set ( $ currentTime , $ record ) ; $ cache -> set ( $ id , serialize ( $ recordBag ) ) ; } ) ; }
Stores a single record from a response message in the cache

@param int    $currentTime
@param Record $record
Stores a single record from a response message in the cache