Class FileSystemKeyValueStore
- java.lang.Object
-
- me.insidezhou.southernquiet.keyvalue.driver.FileSystemKeyValueStore
-
- All Implemented Interfaces:
KeyValueStore
public class FileSystemKeyValueStore extends java.lang.Object implements KeyValueStore
基于FileSystem的键值对驱动.
-
-
Constructor Summary
Constructors Constructor Description FileSystemKeyValueStore(FrameworkAutoConfiguration.KeyValueStoreProperties.FileSystem properties, FileSystem fileSystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends java.io.Serializable>
Tget(java.lang.String key)获取键值对(未过期的)。protected java.lang.StringgetFileName(java.lang.String key, int ttl)<T extends java.io.Serializable>
voidput(java.lang.String key, T value, int ttl)设置带ttl控制的键值对。voidremove(java.lang.String... keys)移除指定键值对。<T extends java.io.Serializable>
voidset(java.lang.String key, T value)设置常驻键值对。如果键值对已存在,仅更改键值对值。voidtouch(java.lang.String key, java.lang.Integer ttl)刷新键值对创建时间,以及更改ttl。注意,不保证这是一个原子操作。-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface me.insidezhou.southernquiet.keyvalue.KeyValueStore
put, touch
-
-
-
-
Constructor Detail
-
FileSystemKeyValueStore
public FileSystemKeyValueStore(FrameworkAutoConfiguration.KeyValueStoreProperties.FileSystem properties, FileSystem fileSystem)
-
-
Method Detail
-
put
public <T extends java.io.Serializable> void put(java.lang.String key, T value, int ttl)Description copied from interface:KeyValueStore设置带ttl控制的键值对。- Specified by:
putin interfaceKeyValueStorettl- 必须大于等于0,0为常驻不过期。
-
set
public <T extends java.io.Serializable> void set(java.lang.String key, T value)Description copied from interface:KeyValueStore设置常驻键值对。如果键值对已存在,仅更改键值对值。- Specified by:
setin interfaceKeyValueStore
-
get
public <T extends java.io.Serializable> T get(java.lang.String key)
Description copied from interface:KeyValueStore获取键值对(未过期的)。- Specified by:
getin interfaceKeyValueStore
-
touch
public void touch(java.lang.String key, java.lang.Integer ttl)Description copied from interface:KeyValueStore刷新键值对创建时间,以及更改ttl。注意,不保证这是一个原子操作。- Specified by:
touchin interfaceKeyValueStore- Parameters:
key- 键值ttl- 当不为null时,更改ttl。
-
remove
public void remove(java.lang.String... keys)
Description copied from interface:KeyValueStore移除指定键值对。- Specified by:
removein interfaceKeyValueStore
-
getFileName
protected java.lang.String getFileName(java.lang.String key, int ttl)
-
-