package me.chyxion.tigon.shiro.cache;

import java.io.Serializable;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.session.Session;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.validation.annotation.Validated;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * May 14, 2016 10:47:04 AM
 */
@Validated
public interface SessionCache extends Cache<Serializable, Session> {
    
    /**
     * find sessions by user id
     * @param userId user id
     * @return sessions
     */
    Session findByUserId(@NotBlank Serializable userId);
    
    /**
     * put user session
     * @param session
     * @return
     */
    @NotNull Session putUserSession(@NotNull Session session);

    /**
     * @param session
     * @return
     */
    @NotNull Session put(@NotNull Session session);
}
