首页 > 解决方案 > @google-cloud/redis 获取和设置未找到

问题描述

我在 Google Cloud Platform 上创建了 Redis。我的应用程序正在连接。但是,我不能在我创建的客户端中设置、获取、打开。问题是什么?因为它不在里面。那我要怎么管理?

const connectRedis = async () => {
    const { CloudRedisClient } = require('@google-cloud/redis')
    const thisClient = new CloudRedisClient()

    const formattedParent = thisClient.locationPath('project', 'location')

    const thisRequest = {
        parent: formattedParent
    }

    const thisResponse = (await thisClient.listInstances(thisRequest))[0]
}

thisClient.on || thisClient.on 未找到。

标签: node.jsgoogle-cloud-platformredis

解决方案


@google-cloud/redis 库仅供管理员使用。它不是客户。

请参阅此处的讨论:

https://github.com/googleapis/nodejs-redis/issues/386


推荐阅读