public class TableOptions extends Object implements Jsonizable
TTL: TimeToLive的缩写, TableStore支持数据自动过期, TimeToLive即为数据的存活时间.
服务端根据当前时间, 每列每个版本的版本号, 表的TTL设置决定该列该版本是否过期, 过期的数据会自动清理.MaxVersions: TableStore每行每列中, 最多保存的版本数. 当写入的版本超过MaxVersions时, TableStore只保留版本号最大的MaxVersions个版本.
MaxTimeDeviation: TableStore写入数据所指定的版本与系统时间的偏差允许的最大值,不允许写入与系统偏差大于MaxTimeDeviation的数据。
构造器和说明 |
---|
TableOptions()
构造TableOptions对象。
|
TableOptions(int timeToLive)
构造TableOptions对象。
|
TableOptions(int timeToLive,
int maxVersions)
构造TableOptions对象。
|
TableOptions(int timeToLive,
int maxVersions,
long maxTimeDeviation)
构造TableOptions对象。
|
限定符和类型 | 方法和说明 |
---|---|
long |
getMaxTimeDeviation()
获取允许的指定版本写入数据时所指定的版本与系统当前时间的最大偏差。
|
int |
getMaxVersions()
获取最大版本数。
|
int |
getTimeToLive()
获取TTL时间,单位为秒。
|
boolean |
hasSetMaxTimeDeviation()
查询是否调用
setMaxTimeDeviation(long) 设置了MaxTimeDeviation。 |
boolean |
hasSetMaxVersions()
查询是否调用
setMaxVersions(int) 设置了MaxVerisons。 |
boolean |
hasSetTimeToLive()
查询是否调用
setTimeToLive(int) 设置了TTL。 |
String |
jsonize() |
void |
jsonize(StringBuilder sb,
String newline) |
protected boolean |
jsonizeFields(StringBuilder sb,
boolean firstItem) |
void |
setMaxTimeDeviation(long maxTimeDeviation)
设置允许的指定版本写入数据时所指定的版本与系统当前时间的最大偏差。
|
void |
setMaxVersions(int maxVersions)
设置最大版本数。
|
void |
setTimeToLive(int timeToLive)
设置表数据的TTL时间,单位为秒。
|
String |
toString() |
public TableOptions()
public TableOptions(int timeToLive)
timeToLive
- TTL时间public TableOptions(int timeToLive, int maxVersions)
timeToLive
- TTL时间maxVersions
- 最大保留版本数public TableOptions(int timeToLive, int maxVersions, long maxTimeDeviation)
timeToLive
- TTL时间maxVersions
- 最大保留版本数maxTimeDeviation
- 允许写入的指定版本与系统时间最大偏差public int getTimeToLive()
IllegalStateException
- 若没有配置该参数public void setTimeToLive(int timeToLive)
timeToLive
- TTL时间,单位为秒public boolean hasSetTimeToLive()
setTimeToLive(int)
设置了TTL。public int getMaxVersions()
IllegalStateException
- 若没有配置该参数public void setMaxVersions(int maxVersions)
maxVersions
- 最大版本数public boolean hasSetMaxVersions()
setMaxVersions(int)
设置了MaxVerisons。public long getMaxTimeDeviation()
IllegalStateException
- 若没有配置该参数public void setMaxTimeDeviation(long maxTimeDeviation)
maxTimeDeviation
- 最大偏差,单位秒public boolean hasSetMaxTimeDeviation()
setMaxTimeDeviation(long)
设置了MaxTimeDeviation。public String jsonize()
jsonize
在接口中 Jsonizable
public void jsonize(StringBuilder sb, String newline)
jsonize
在接口中 Jsonizable
protected boolean jsonizeFields(StringBuilder sb, boolean firstItem)
Copyright © 2019. All Rights Reserved.