public function read($key, $next)
    {
        $session_key = $this->sanitize($key);

        $data = wp_cache_get("session_${session_key}", 'sessions');
        if (false === $data) {
            // Passing the key unsanitized to the next handler to avoid weirdness.
            $data = $next($key);
            if (false !== $data) {
                wp_cache_set("session_${session_key}", $data, 'sessions', $this->getExpiration());
            }
        }

        return $data;
    }
public function read($key, $next)
    {
        $session_key = $this->sanitize($key);

        $data = wp_cache_get("session_${session_key}", 'sessions');
        if (false === $data) {
            // Passing the key unsanitized to the next handler to avoid weirdness.
            $data = $next($key);
            if (false !== $data) {
                wp_cache_set("session_${session_key}", $data, 'sessions', $this->getExpiration());
            }
        }

        return $data;
    }
public function read ( $ key , $ next ) { $ session_key = $ this -> sanitize ( $ key ) ; $ data = wp_cache_get ( "session_${session_key}" , 'sessions' ) ; if ( false === $ data ) { // Passing the key unsanitized to the next handler to avoid weirdness. $ data = $ next ( $ key ) ; if ( false !== $ data ) { wp_cache_set ( "session_${session_key}" , $ data , 'sessions' , $ this -> getExpiration ( ) ) ; } } return $ data ; }
Grab the item from the cache if it exists, otherwise delve deeper
into the stack and retrieve from another underlying middleware.

@param string   $key  Session identifier.
@param callable $next Next read operation in the stack, might not be needed.

@return mixed
Grab the item from the cache if it exists otherwise delve deeper into the stack and retrieve from another underlying middleware .