org.infinispan.client.hotrod.impl.EagerNearRemoteCache Maven / Gradle / Ivy
package org.infinispan.client.hotrod.impl;
import org.infinispan.client.hotrod.RemoteCacheManager;
import org.infinispan.client.hotrod.VersionedValue;
import org.infinispan.client.hotrod.near.NearCacheService;
/**
* Near {@link org.infinispan.client.hotrod.RemoteCache} implementation
* enabling
*
* @param
* @param
*/
@Deprecated
public class EagerNearRemoteCache extends RemoteCacheImpl {
private final NearCacheService nearcache;
public EagerNearRemoteCache(RemoteCacheManager rcm, String name, NearCacheService nearcache) {
super(rcm, name);
this.nearcache = nearcache;
}
@Override
public V get(Object key) {
VersionedValue versioned = getVersioned((K) key);
return versioned != null ? versioned.getValue() : null;
}
@Override
public VersionedValue getVersioned(K key) {
VersionedValue nearValue = nearcache.get(key);
if (nearValue == null) {
VersionedValue remoteValue = super.getVersioned(key);
if (remoteValue != null)
nearcache.putIfAbsent(key, remoteValue);
return remoteValue;
}
return nearValue;
}
@Override
public void start() {
nearcache.start(this);
}
@Override
public void stop() {
nearcache.stop(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy