@startuml
title Ehcache Put-If-Absent Operation

AppDev -> Cache: putIfAbsent(K, V)
activate Cache
Cache -> ClusteredStore: putIfAbsent(K, V)
activate ClusteredStore
ClusteredStore-> ServerStoreProxy: getAndAppend(hash(K), putIfAbsent(K, V))
activate ServerStoreProxy
ServerStoreProxy -> EntityClientEndpoint: invoke(message(alias, getAndAppend))
activate EntityClientEndpoint
EntityClientEndpoint -> EhcacheActiveEntity: message(alias, binary)
activate EhcacheActiveEntity

box "Server" #LightBlue
participant EhcacheActiveEntity
participant ServerStore
end box

EhcacheActiveEntity -> EhcacheActiveEntity: getStore(alias)
EhcacheActiveEntity -> ServerStore: getAndAppend(hash(K), binary)
activate ServerStore
ServerStore --> EhcacheActiveEntity: List<Blob>
deactivate ServerStore
EhcacheActiveEntity --> EntityClientEndpoint: response(List<Blob>)
deactivate EhcacheActiveEntity
EntityClientEndpoint --> ServerStoreProxy: List<Blob>
deactivate EntityClientEndpoint
ServerStoreProxy --> ClusteredStore: List<BiFunction<K, V, V>>
deactivate ServerStoreProxy
ClusteredStore->ClusteredStore: resolve
alt K mapped to V
ClusteredStore-->Cache: V-old
Cache-->AppDev: V-old
else K not mapped
ClusteredStore-->Cache: null
deactivate ClusteredStore
Cache-->AppDev: null
deactivate Cache
end
@enduml