【问题标题】:Flutter & Redis clientFlutter & Redis 客户端
【发布时间】:2020-02-17 18:51:34
【问题描述】:

我有(聊天)Flutter 移动应用程序,它使用 Lumen 作为后端。但是,我想缓存一些东西,并想为此目的使用 Redis。 Flutter 应用程序如何与 Redis 对话?我应该为此安装一些包还是为每个缓存发出 HTTP 请求?

我的目标是存储最后的对话消息。

在后端我可以这样做:

Redis::hSet('chat1', 'message', 'hello');

但我不确定这将如何影响性能......因此,最好在前端(Flutter)上安装 Redis 客户端。

【问题讨论】:

    标签: php flutter redis


    【解决方案1】:

    你可以使用包https://pub.dev/packages/redis
    这个包是Redis的客户端Dart

    代码sn-p

    import 'package:redis/redis.dart';
    ...
    RedisConnection conn = new RedisConnection();
    conn.connect('localhost',6379).then((Command command){
        command.send_object(["SET","key","0"]).then((var response)
            print(response);
        )
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-19
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 2022-01-20
      • 2014-04-11
      • 1970-01-01
      • 2018-03-22
      相关资源
      最近更新 更多