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

cn.dev33.satoken.solon.model.SaStorageForSolon Maven / Gradle / Ivy

There is a newer version: 1.39.0
Show newest version
package cn.dev33.satoken.solon.model;

import cn.dev33.satoken.context.model.SaStorage;
import org.noear.solon.core.handle.Context;

/**
 * @author noear
 * @since 1.4
 */
public class SaStorageForSolon implements SaStorage {

    protected Context ctx;

    public SaStorageForSolon() {
        ctx = Context.current();
    }

    @Override
    public Object getSource() {
        return ctx;
    }

    @Override
    public SaStorageForSolon set(String key, Object value) {
        ctx.attrSet(key, value);
        return this;
    }

    @Override
    public Object get(String key) {
        return ctx.attr(key);
    }

    @Override
    public SaStorageForSolon delete(String key) {
        ctx.attrMap().remove(key);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy