Closed javafanboy closed 2 years ago
Of course -- there is no difference between community and commercial editions in this regard.
In general, any thread-safe java.util.Map
implementation is an acceptable replacement for com.tangosol.net.cache.LocalCache
(which is what is used by default), but it may limit the features that are available.
For example, to support events, it also needs to implement com.tangosol.util.ObservableMap
interface, and to support caching (expiry, eviction, etc.) it needs to implement com.tangosol.net.cache.CacheMap
, or better yet, com.tangosol.net.cache.ConfigurableCacheMap
interface.
The above may require a lot of work to implement properly, so if you don't mind me asking, what are you trying to accomplish that one of the built-in implementations don't provide? If it's something that you think is generally useful, we are happy to accept contributions as well ;-)
Great - some thoughts I had in mind was to look into developing implementations using Caffeine (i would also like @ben-manes take advantage of TinyFLU but at the same time have some other goodness provided by Coherence) and a local OSS KeyValue Database library like RocksDB or a high performance persisted Map like Chronicle Map (as Coherence CE as I understand it lacks the "elastic data" feature present in the commercial version). Are there any blog-post or documentation section that you can sugest that clearly explains what you need to do in addition to implementing the class to use it as "part of" Coherence (i.e. how to configure its use etc.)? Assuming I actually decide to do this I would of course be happy to contribute - that is what OSS is all about!
Awesome. There is already #16 and I just reached out to @ben-manes to see if he's willing to restart that work, and he is. Are you on public Coherence Slack? May be easier to continue specific discussion there.
But to answer your question, the backing map to use is configured via backing-map-scheme
within cache config.
By default, most cache configs will have something like this within one of the higher level cache schemes, such as distributed-cache-scheme
:
<backing-map-scheme>
<local-scheme/>
</backing-map-scheme>
which will create and configure an instance of a LocalCache
.
You can specify custom implementation via class-scheme
:
<backing-map-scheme>
<class-scheme>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
</backing-map-scheme>
Also, funny that you mention RocksDB and Chronicle: I'm actually looking into possible integration points with both Chronicle Map and Chronicle Queue myself for the last few days, and @mgamanho is playing with RocksDB atm.
Fortuitous timing, I guess... ;-)
Finally, in case you decide to contribute, please go ahead and sign the Oracle Contributor Agreement, so we don't have any admin hurdles in a way when the time comes to merge pull requests.
Also, please review Contributing Guidelines and Developer Guidelines before starting.
Type of question
Question about availability of a feature
Question
What did you do? A clear and concise description of the steps you took (or insert a code snippet).
I would like to be able to write my own cache map implementation with Coherent community edition - is this possible?