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

io.vertx.tp.plugin.shared.SharedClient Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.tp.plugin.shared;

import io.vertx.codegen.annotations.Fluent;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.core.shareddata.AsyncMap;
import io.vertx.core.shareddata.LocalMap;
import io.vertx.up.uca.container.Kv;

/**
 * Shared client for shared data in vert.x
 */
public interface SharedClient {
    /**
     * Create local map from shared data
     */
    static  SharedClient createShared(final Vertx vertx, final JsonObject config, final String name) {
        return new SharedClientImpl(vertx).create(config, name);
    }

    /**
     * Get reference of AsyncMap
     */
    AsyncMap fetchAsync();

    /**
     * Get reference of LocalMap
     */
    LocalMap fetchSync();

    SharedClient switchClient(final String name);

    Kv put(K key, V value);

    Kv put(K key, V value, int expiredSecs);

    Kv remove(K key);

    V get(K key);

    V get(K key, boolean once);

    @Fluent
    SharedClient put(K key, V value, Handler>> handler);

    @Fluent
    SharedClient put(K key, V value, int expiredSecs, Handler>> handler);

    @Fluent
    SharedClient remove(K key, Handler>> handler);

    @Fluent
    SharedClient get(K key, Handler> handler);

    @Fluent
    SharedClient get(K key, boolean once, Handler> handler);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy