The @Marshallable stuff is internal only (for now). We may make it public API at some point, once we have a proper scheme to ensure magic numbers don't collide.
Re: protobufs, the best way to do this is for you to handle the marshalling of values outside of the cache. E.g., Object -> byte, and then cache.put(key, byte).
Thanks for info, for now I'll stick to using byte. In the future it would be nice to be able to use generics e.g.
ConcurrentMap<Integer, SomeProtoBufClass> myTypeSafeCache = manager.getCache("myCache");
In order to do this kind of stuff efficiently, flexible (extensible) serialization mechanism would be helpful.
The simplest solution might be adding configuration parameter to the cache (serializer="mySerializerClass"). Serializer class would implement Infinispan interface, which would declare methods to do conversion Object <-> byte. That way everyone could plug whatever they come up with (for instance Protocol Buffer). Just a suggestion .