Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1901#discussion_r121032772
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/AtomicDistributedMapCacheClient.java
---
@@ -71,6 +73,23 @@
* @return true only if the key is replaced.
* @throws IOException if unable to communicate with the remote
instance
*/
+ @Deprecated
<K, V> boolean replace(K key, V value, Serializer<K> keySerializer,
Serializer<V> valueSerializer, long revision) throws IOException;
--- End diff --
Would it be a better refactoring if we make this method signature as:
```
<K, V> boolean replace(CacheEntry<K, V> Serializer<K> keySerializer,
Serializer<V> valueSerializer) throws IOException
```
This way we can create a subclass of CacheEntry, such as
CacheEntryWithRevision and within the method we can decide which replacing
logic to use.
Or we may be able to use generics for revision:
```
interface CacheEntry<K, V> -> interface CacheEntry<K, V, R>
```
Then `R` can be long for some implementation, or String if target cache
system doesn't support it.
The reason why I used revision is that passing new and previous value would
double the size we need to send through network. There are various cache
implementation and some support things like revision and some don't. When it
does support revision, I think we should utilize it.
Actually, I'm working on adding new MapCacheClient against Couchbase
Server, and it supports revision.
https://github.com/ijokarumawak/nifi/commit/f43df899813d3f46eafb78a1164b8818f055f7f6#diff-40925d0ac131c75c2073f168b45fdb93R173
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---