简体   繁体   English

Thrift可以在PHP中维护Memcached持久连接吗

[英]Can Thrift maintain Memcached persistent connection in php

I am writing one c++ client which using my PHP Thrift server. 我正在使用我的PHP Thrift服务器编写一个c ++客户端。

I want Thrift persistent communicate with client to server. 我希望Thrift与客户端到服务器进行持久通信。

And Thrift can communicate client & server persistent connection but inside my PHP Thrift server I am using Memcached server and it can be also persistent. Thrift可以传达客户端和服务器的持久连接,但是在我的PHP Thrift服务器内部,我使用的是Memcached服务器,它也可以是持久的。 Mostly PHP Memcached persistent connection maintained by web server. 通常由Web服务器维护的PHP Memcached持久连接。

So can my PHP Thrift server maintain Memcached persistent connection ? 那么我的PHP Thrift服务器可以维护Memcached持久连接吗?

If not should I have to use any other language like which make this possible? 如果不是,我是否必须使用其他语言才能实现?

To connect to Memcached, you have to use some kind of connector which is able to talk to Memcached using it's own protocol described here . 要连接到Memcached,您必须使用某种连接器,该连接器可以使用此处描述的自有协议与Memcached进行通信。 This protocol is completely different from anything that Thrift supports today. 该协议与Thrift今天支持的协议完全不同。

However, you may want to use Thrift to serialize your data before storing them into Memcached. 但是,您可能需要先使用Thrift序列化数据,然后再将其存储到Memcached中。 That would be an absolutely valid and reasonable use case. 那将是一个绝对有效和合理的用例。 Especially as you are already using Thrift for the C++/PHP connection and because this would enable you to access the data from both C++ and PHP without too much hassle, if the latter is needed. 特别是当您已经在使用Thrift进行C ++ / PHP连接时,因为这样可以使您从C ++和PHP中访问数据而无需太多麻烦(如果需要后者)。

Unfortunately, Memcached does not (yet) offer a Thrift service API, which is honestly not such a bad idea in my opinion. 不幸的是,Memcached还没有提供Thrift服务API,老实说,这并不是一个坏主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM