首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Botman对话缓存时间不工作

Botman对话缓存时间不工作
EN

Stack Overflow用户
提问于 2020-10-07 16:53:17
回答 1查看 401关注 0票数 0

BotMan版本: 2.6

PHP版本: 7.3.23

Laravel版本: 7.16.1

缓存驱动程序: LaravelCache

我在用botman做电报机器人。botman一切都很好,只是会话缓存时间不起作用。这是我的botman配置代码:

代码语言:javascript
复制
use BotMan\BotMan\Cache\LaravelCache;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\BotMan\BotManFactory;

$config = [
    // Your driver-specific configuration
    "botman" => [
        'conversation_cache_time' => 720 ,
        'user_cache_time' => 720,
    ],
    "telegram" => [
        "token" => env('TELEGRAM_TOKEN'),
    ]
];
// Load the driver(s) you want to use
DriverManager::loadDriver(\BotMan\Drivers\Telegram\TelegramDriver::class);

// Create an instance
$botman = BotManFactory::create($config, new LaravelCache());

//  and other hears , fallback and conversations functions ...

关于机器人和会话的一切都很好,但问题是基于我们必须使用驱动器缓存来使用会话的conversation document的会话现金时间,我使用的驱动程序是laravelCache,但我将conversation_cache_time设置为720分钟,但它只需要默认的30分钟。

我该怎么办?

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-10 14:31:41

从他们的github中的这些行:

https://github.com/botman/botman/blob/79310f6e6464436aaa2d0522267b2ca00a07fda5/tests/BotManConversationTest.php#L79-L83

https://github.com/botman/botman/blob/4ec6e3f30d620cbcb73a0cf8e1dbf6b34e47f75d/src/Traits/HandlesConversations.php#L47

https://github.com/botman/botman/blob/203e7f5ef68473dd4d71ca7ee31275eae9a92745/src/BotMan.php#L238-L239

它必须是这样的:

代码语言:javascript
复制
$config = [
    'user_cache_time' => 720,

    'config' => [
        'conversation_cache_time' => 720 ,
    ],

    // Your driver-specific configuration
    "telegram" => [
        "token" => env('TELEGRAM_TOKEN'),
    ]
];

而且它是有效的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64240554

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档