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

com.blade.mvc.SessionManager Maven / Gradle / Ivy

package com.blade.mvc;

import com.blade.mvc.http.Session;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * SessionManager
 *
 * @author biezhi
 *         2017/6/3
 */
public class SessionManager {

    private Map sessionMap;

    public SessionManager() {
        this.sessionMap = new ConcurrentHashMap<>();
    }

    public Session getSession(String id) {
        return sessionMap.get(id);
    }

    public void addSession(Session session) {
        sessionMap.put(session.id(), session);
    }

    public void clear() {
        sessionMap.clear();
    }

    public void remove(Session session) {
        sessionMap.remove(session.id());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy