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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?