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.)

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

报告相同问题?

悬赏问题

  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题