org.terracotta.modules.ehcache.store.nonstop.NoOpOnTimeoutStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
/**
* Copyright Terracotta, Inc. Licensed 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.terracotta.modules.ehcache.store.nonstop;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.Element;
import net.sf.ehcache.Status;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.search.Attribute;
import net.sf.ehcache.search.NullResults;
import net.sf.ehcache.search.Results;
import net.sf.ehcache.search.attribute.AttributeExtractor;
import net.sf.ehcache.store.ElementValueComparator;
import net.sf.ehcache.store.Policy;
import net.sf.ehcache.store.StoreListener;
import net.sf.ehcache.store.StoreQuery;
import net.sf.ehcache.store.TerracottaStore;
import net.sf.ehcache.writer.CacheWriterManager;
import net.sf.ehcache.writer.writebehind.WriteBehind;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Implementation of {@link TerracottaStore} which returns null for all get operations and does nothing for puts and
* removes.
*
* @author Abhishek Sanoujam
*/
public final class NoOpOnTimeoutStore implements TerracottaStore {
/**
* the singleton instance
*/
private static final NoOpOnTimeoutStore INSTANCE = new NoOpOnTimeoutStore();
/**
* private constructor
*/
private NoOpOnTimeoutStore() {
//
}
/**
* Returns the singleton instance
*
* @return the singleton instance
*/
public static NoOpOnTimeoutStore getInstance() {
return INSTANCE;
}
/**
* {@inheritDoc}
*/
@Override
public void addStoreListener(StoreListener listener) {
// no-op
}
/**
* {@inheritDoc}
*/
@Override
public boolean bufferFull() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsKey(Object key) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsKeyInMemory(Object key) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsKeyOffHeap(Object key) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsKeyOnDisk(Object key) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void dispose() {
// no-op
}
/**
* {@inheritDoc}
*/
@Override
public Results executeQuery(StoreQuery query) {
return NullResults.INSTANCE;
}
/**
* {@inheritDoc}
*/
@Override
public void expireElements() {
// no-op
}
/**
* {@inheritDoc}
*/
@Override
public void flush() {
// no-op
}
/**
* {@inheritDoc}
*/
@Override
public Element get(Object key) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Policy getInMemoryEvictionPolicy() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public int getInMemorySize() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public long getInMemorySizeInBytes() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public Object getInternalContext() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public List getKeys() {
return Collections.EMPTY_LIST;
}
/**
* {@inheritDoc}
*/
@Override
public Object getMBean() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public int getOffHeapSize() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public long getOffHeapSizeInBytes() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getOnDiskSize() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public long getOnDiskSizeInBytes() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean hasAbortedSizeOf() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public Element getQuiet(Object key) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Map