duanjue6575 2012-04-16 22:50
浏览 42
已采纳

使用Go和Java在Gae上共享Memcache

Can I write to the memcache from Go and read it from Java (on appengine)?

From the memcache viewer it looks like the answer is no, since there are keys of type "Java string" and "Go string". What about sharing []byte?

Are web-hooks and the data store the only ways of communicating between Java and Go on Appengine?

Thanks

  • 写回答

1条回答 默认 最新

  • drexlz0623 2012-04-17 09:37
    关注

    I don't know the answer to your question, but you will find part of it in method makePbKey in MemcacheSerialization.java. That shows how Java takes an Object and makes a key out of it.

    Likewise, in file appengine/memcache/memcache.go, you can see how AppEngine for Go makes a key out of Item.Key (type string). See GetMulti, where each key is converted from a string to a []byte via a simple cast.

    So, the final answer to your question depends on you finding a path through both mkPbKey and GetMulti that results in the same key. It seems to me like if you give Java a key of type String, and it has length less than 250, and you remember to put "" before and after your keys in Go, it might work. (But reading mkPbKey makes me wonder how it reacts to a string which has 200 code points in it, all of which result in multi-byte encodings in UTF-8. Seems like it will produce a bigger key than they are expecting.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置