All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.sinri.keel.cache.KeelAsyncEverlastingCacheInterface Maven / Gradle / Ivy

Go to download

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.KeelCacheGimel;
import io.vertx.core.Future;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Map;

/**
 * @param 
 * @param 
 * @since 2.9
 */
public interface KeelAsyncEverlastingCacheInterface {
    static  KeelAsyncEverlastingCacheInterface createDefaultInstance() {
        return new KeelCacheGimel<>();
    }

    default long getLockWaitMs() {
        return 100;
    }

    /**
     * Save the item to cache.
     */
    Future save(@Nonnull K k, V v);

    Future save(@Nonnull Map appendEntries);

    /**
     * @return cache value or null when not-existed
     * @since 2.9.4 return Future
     */
    default Future 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
     * @since 2.9.4 return Future
     */
    Future read(@Nonnull K k, V v);

    /**
     * Remove the cached item with key.
     *
     * @param key key
     */
    Future remove(@Nonnull K key);

    Future remove(@Nonnull Collection keys);

    /**
     * Remove all the cached items.
     */
    Future removeAll();

    /**
     * Replace all entries in cache map with new entries.
     *
     * @param newEntries new map of entries
     */
    Future replaceAll(@Nonnull Map newEntries);

    /**
     * @return ConcurrentMap K → V alive value only
     * @since 1.14
     */
    @Nonnull
    Map getSnapshotMap();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy