2
A
回答
0
我有同樣的問題。我發現這個鏈接顯示了使用PHP創建的客戶端。我能夠以此爲基礎創建Java客戶端:http://blog.shupp.org/2011/05/07/getting-started-with-kestrel-from-a-php-application/
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import net.spy.memcached.MemcachedClient;
public class KestrelClient {
private MemcachedClient client = null;
private String kestrelHost = null;
private int kestrelPort = -1;
public KestrelClient(final String kestrelHost, final int kestrelPort)
{
this.kestrelHost = kestrelHost;
this.kestrelPort = kestrelPort;
try
{
this.client = new MemcachedClient(new InetSocketAddress(this.kestrelHost, this.kestrelPort));
}
catch (IOException e)
{
e.printStackTrace();
}
}
public boolean set(final String queueName, final int expiration, final Object data)
{
Future<Boolean> setFuture = this.client.set(queueName, expiration, data);
try
{
return setFuture.get().booleanValue();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
catch (ExecutionException e)
{
e.printStackTrace();
}
return false;
}
public Object reliableRead(final String queueName, final int timeout)
{
Object object = this.client.get(queueName + "/close/open/t=" + timeout);
closeReliableRead(queueName);
return object;
}
public void closeReliableRead(final String queueName)
{
this.client.get(queueName + "/close");
}
public void abortReliableRead(final String queueName)
{
this.client.get(queueName + "/abort");
}
}
它並不完美,但它應該讓你開始。 (依賴於spymemcached。)
祝你好運!
0
我有同樣的問題。我最初使用xmemcached客戶端,但後來發現使用它簡單的包裝更容易使用。這包裝成了jestrel,這是可以在這裏下的Apache許可證:
https://github.com/cobbzilla/jestrel
我設計極致簡約的jestrel API。它已經在生產環境中測試並且性能良好。試試看,讓我知道你的想法。
相關問題
- 1. 指南針文檔教程
- 2. Kohana新手應該知道哪些文檔/教程/指南?
- 3. 教程/指南包(Debian的)
- 4. 學習指南/教程html5
- 5. HTML5/CSS3指南或教程
- 6. khtml庫教程/指南?
- 7. CMake文檔指南
- 8. PowerBuilder Classic 12/12.5指南/教程
- 9. C#中的X509指南/教程#
- 10. 學習phantomjs的權威指南/教程
- 11. Mechanical Turk教程或操作指南
- 12. Hyperledger開發者指南教程
- 13. Android NDK教程/初學者指南。
- 14. 好的.Net Remoting教程/指南
- 15. 紅隼使用的文件夾路徑
- 16. 紅隼跑哪個框架?
- 17. 紅隼與asp.net 1.0核心
- 18. URI教程/文檔
- 19. Pechkin文檔/教程
- 20. ASCII文本文檔的樣式指南
- 21. 哪裏可以找到boost :: fusion文章,示例,指南,教程?
- 22. Django-openauth-id文檔和安裝指南
- 23. Joosy指南文檔面臨的挑戰
- 24. Swift 2官方指南/文檔鏈接?
- 25. 尋找jquery上的插件,使指南,教程,指導頁
- 26. ffmpeg C API文檔/教程
- 27. 「acts_as_ferret」的文檔或教程
- 28. EZPDF - 文檔,教程,什麼?
- 29. '排隊'教程和文檔?
- 30. Livekd文檔和教程