io.github.sinri.keel.cache.KeelEverlastingCacheInterface Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Keel Show documentation
Show all versions of Keel Show documentation
A website framework with VERT.X for ex-PHP-ers, exactly Ark Framework Users.
The newest version!
package io.github.sinri.keel.cache;
import io.github.sinri.keel.cache.impl.KeelCacheVet;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Map;
/**
* @param
* @param
* @since 2.9
*/
public interface KeelEverlastingCacheInterface {
static KeelEverlastingCacheInterface createDefaultInstance() {
return new KeelCacheVet<>();
}
/**
* Save the item to cache.
*/
void save(@Nonnull K k, V v);
void save(@Nonnull Map appendEntries);
/**
* @return cache value or null when not-existed
*/
default V read(@Nonnull K k) {
return read(k, null);
}
/**
* @param k key
* @param v default value for the situation that key not existed
* @return @return cache value or default when not-existed
*/
V read(@Nonnull K k, V v);
/**
* Remove the cached item with key.
*
* @param key key
*/
void remove(@Nonnull K key);
void remove(@Nonnull Collection keys);
/**
* Remove all the cached items.
*/
void removeAll();
/**
* Replace all entries in cache map with new entries.
*
* @param newEntries new map of entries
*/
void replaceAll(@Nonnull Map newEntries);
/**
* @return ConcurrentMap K → V alive value only
* @since 1.14
*/
@Nonnull
Map getSnapshotMap();
// class LockedException extends Exception{
// public LockedException(){
// super("KeelEverlastingCacheInterface Locked");
// }
// public LockedException(String msg){
// super(msg);
// }
// public LockedException(Throwable throwable){
// super(throwable);
// }
// }
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy