gpt4 book ai didi

nest - 弹性客户端处置

转载 作者:行者123 更新时间:2023-12-04 12:50:22 25 4
gpt4 key购买 nike

我是新手。我正在使用 ElasticClient (.Net),我很好奇:

  • 它是线程安全的吗?我认为是因为它使用池化。
  • 完成后我应该做些什么来清理客户端资源吗?它没有实现 IDisposable。

  • 谢谢!

    鲍勃

    最佳答案

    关于线程安全:https://github.com/elastic/elasticsearch-net/issues/23

    The ElasticClient holds a single IConnection responsible for doing async and sync http calls. The IConnection does not reuse httprequests and uses thread local state for data thats being passed around during the stages of the request. It should thus be thread safe.



    关于处置: https://github.com/elastic/elasticsearch-net/issues/101

    ElasticClient is almost stateless except for a static CLR type info cache that is threadsafe so you can even use one client over threads. Disposing is also handled by Nest and ElasticClient only exposes POCO's.

    关于nest - 弹性客户端处置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31090450/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com