![JAR search and dependency download from the Maven repository](/logo.png)
org.drools.reliability.infinispan.InfinispanStorage Maven / Gradle / Ivy
The newest version!
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.drools.reliability.infinispan;
import org.drools.core.common.Storage;
import org.infinispan.commons.api.BasicCache;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
public class InfinispanStorage implements Storage {
private BasicCache cache;
public static Storage fromCache(BasicCache cache) {
return new InfinispanStorage<>(cache);
}
private InfinispanStorage(BasicCache cache) {
this.cache = cache;
}
@Override
public V get(K key) {
return cache.get(key);
}
@Override
public V getOrDefault(K key, V value) {
return cache.getOrDefault(key, value);
}
@Override
public V put(K key, V value) {
return cache.put(key, value);
}
@Override
public void putAll(Map extends K, ? extends V> otherMap) {
cache.putAll(otherMap);
}
@Override
public boolean containsKey(K key) {
return cache.containsKey(key);
}
@Override
public V remove(K key) {
return cache.remove(key);
}
@Override
public void clear() {
cache.clear();
}
@Override
public Collection values() {
return cache.values();
}
@Override
public Set keySet() {
return cache.keySet();
}
@Override
public int size() {
return cache.size();
}
@Override
public boolean isEmpty() {
return cache.isEmpty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy