Hi all, I was toying with a custom CacheStore experiment, and am having some friction with some of the new SPIs.
So interface org.infinispan.marshall.core.MarshalledEntryFactory<K, V> is an helper to use in the CacheStorei implementation, which exposes three methods: MarshalledEntry<K,V> newMarshalledEntry(ByteBuffer key, ByteBuffer valueBytes, ByteBuffer metadataBytes); MarshalledEntry<K,V> newMarshalledEntry(Object key, ByteBuffer valueBytes, ByteBuffer metadataBytes); MarshalledEntry<K,V> newMarshalledEntry(Object key, Object value, InternalMetadata im); In my CacheStore - and I suspect most efficiency minded implementations - I don't care about the value Object but I express a specific physical layout for the metadata, so to run for example an efficient "purge expired" task. So, the key is given, the value Object needs to be serialized, but the InternalMetadata I can map to specific fields. Problem is at read time: I don't have a marshalled version of the Metadata but I need to unmarshall the value.. there is no helper to cover for this case. Wouldn't this interface be more practical if it had: Object unMarshallKey(ByteBuffer); Object unMarshallValue(ByteBuffer); InternalMetadata unMarshallMetadata(ByteBuffer); MarshalledEntry newMarshalledEntry(Object key, Object value, InternalMetadata im); Also, I'd get rid of generics. They are not helping at all, I can hardly couple my custom CacheStore implementation to the end user's domain model, right? I was also quite surprised that other existing CacheStore implementations don't have this limitation; peeking in the JDBCCacheStore to see how this is supposed to work, it seems that essentially it duplicates the data by serializazing the InternalMetadata in the BLOB but also stored an Expiry column to query via SQL. I was interested to see how the Purge method could be implemented efficiently, and found a "TODO notify listeners" ;-) All other JDBC based stores serialize buckets in groups, REST store doesn't do purging, LevelDB also does duplication for the metadata, Cassandra is outdated and doesn't do events on expiry. _______________________________________________ infinispan-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/infinispan-dev
