
com.github.tonivade.resp.StateHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resp-server Show documentation
Show all versions of resp-server Show documentation
Netty implementation of REdis Serialization Protocol, and a simple framework to implement command based protocols
/*
* Copyright (c) 2015-2019, Antonio Gabriel Muñoz Conejo
* Distributed under the terms of the MIT License
*/
package com.github.tonivade.resp;
import java.util.HashMap;
import java.util.Map;
import com.github.tonivade.purefun.type.Option;
public class StateHolder {
private final Map state = new HashMap<>();
@SuppressWarnings("unchecked")
public Option getValue(String key) {
return (Option) Option.of(() -> state.get(key));
}
@SuppressWarnings("unchecked")
public Option removeValue(String key) {
return (Option) Option.of(() -> state.remove(key));
}
public void putValue(String key, Object value) {
state.put(key, value);
}
public void clear() {
state.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy