public function get($key, $default = null)
    {
        // Get document
        $document = $this->collection->getDocument($key);
        if (!$document) {
            return $default;
        }

        // Mongo deletes document not exactly when set in field
        // Required date checking
        // Expiration may be empty for keys which never expired
        $expiredAt = $document->get(self::FIELD_NAME_EXPIRED);
        if (!empty($expiredAt) && $expiredAt->sec < time()) {
            return $default;
        }

        // Return value
        return $document->get(self::FIELD_NAME_VALUE);
    }
public function get($key, $default = null)
    {
        // Get document
        $document = $this->collection->getDocument($key);
        if (!$document) {
            return $default;
        }

        // Mongo deletes document not exactly when set in field
        // Required date checking
        // Expiration may be empty for keys which never expired
        $expiredAt = $document->get(self::FIELD_NAME_EXPIRED);
        if (!empty($expiredAt) && $expiredAt->sec < time()) {
            return $default;
        }

        // Return value
        return $document->get(self::FIELD_NAME_VALUE);
    }
public function get ( $ key , $ default = null ) { // Get document $ document = $ this -> collection -> getDocument ( $ key ) ; if ( ! $ document ) { return $ default ; } // Mongo deletes document not exactly when set in field // Required date checking // Expiration may be empty for keys which never expired $ expiredAt = $ document -> get ( self :: FIELD_NAME_EXPIRED ) ; if ( ! empty ( $ expiredAt ) && $ expiredAt -> sec < time ( ) ) { return $ default ; } // Return value return $ document -> get ( self :: FIELD_NAME_VALUE ) ; }
Get value by key

@param string $key
@param mixed $default

@return mixed
Get value by key