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

io.vertx.ext.web.sstore.LocalSessionStore Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  and Apache License v2.0 which accompanies this distribution.
 *
 *  The Eclipse Public License is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  The Apache License v2.0 is available at
 *  http://www.opensource.org/licenses/apache2.0.php
 *
 *  You may elect to redistribute this code under either of these licenses.
 */

package io.vertx.ext.web.sstore;

import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.sstore.impl.LocalSessionStoreImpl;

/**
 * A session store which is only available on a single node.
 * 

* Can be used when sticky sessions are being used. * * @author Tim Fox * @author Paulo Lopes */ @VertxGen public interface LocalSessionStore extends SessionStore { /** * Default of how often, in ms, to check for expired sessions */ long DEFAULT_REAPER_INTERVAL = 1000; /** * Default name for map used to store sessions */ String DEFAULT_SESSION_MAP_NAME = "vertx-web.sessions"; /** * Create a session store * * @param vertx the Vert.x instance * @return the session store */ static LocalSessionStore create(Vertx vertx) { LocalSessionStoreImpl store = new LocalSessionStoreImpl(); store.init(vertx, new JsonObject() .put("reaperInterval", DEFAULT_REAPER_INTERVAL) .put("mapName", DEFAULT_SESSION_MAP_NAME)); return store; } /** * Create a session store * * @param vertx the Vert.x instance * @param sessionMapName name for map used to store sessions * @return the session store */ static LocalSessionStore create(Vertx vertx, String sessionMapName) { LocalSessionStoreImpl store = new LocalSessionStoreImpl(); store.init(vertx, new JsonObject() .put("reaperInterval", DEFAULT_REAPER_INTERVAL) .put("mapName", sessionMapName)); return store; } /** * Create a session store * * @param vertx the Vert.x instance * @param sessionMapName name for map used to store sessions * @param reaperInterval how often, in ms, to check for expired sessions * @return the session store */ static LocalSessionStore create(Vertx vertx, String sessionMapName, long reaperInterval) { LocalSessionStoreImpl store = new LocalSessionStoreImpl(); store.init(vertx, new JsonObject() .put("reaperInterval", reaperInterval) .put("mapName", sessionMapName)); return store; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy