Skip to content

Commit

Permalink
Update ttl-options.md (#1879)
Browse files Browse the repository at this point in the history
update TTL desc
  • Loading branch information
abby-cyber committed Jun 14, 2022
1 parent b8f5ae9 commit 9213860
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CREATE EDGE [IF NOT EXISTS] <edge_type_name>
|`NULL \| NOT NULL`|指定属性值是否支持为`NULL`。默认值为`NULL`|
|`DEFAULT`|指定属性的默认值。默认值可以是一个文字值或 Nebula Graph 支持的表达式。如果插入边时没有指定某个属性的值,则使用默认值。|
|`COMMENT`|对单个属性或 Edge type 的描述。最大为 256 字节。默认无描述。|
|`TTL_DURATION`|指定属性存活时间。超时的属性将会过期。属性值和时间戳差值之和如果小于当前时间戳,属性就会过期。默认值为`0`,表示属性永不过期。|
|`TTL_DURATION`|指定时间戳差值,单位:秒。时间戳差值必须为 64 位非负整数。属性值和时间戳差值之和如果小于当前时间戳,属性就会过期。默认值为`0`,表示属性永不过期。|
|`TTL_COL`|指定要设置存活时间的属性。属性的数据类型必须是`int`或者`timestamp`。一个 Edge type 只能指定一个字段为`TTL_COL`。更多 TTL 的信息请参见 [TTL](../8.clauses-and-options/ttl-options.md)|

### 示例
Expand Down
12 changes: 6 additions & 6 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ nGQL 支持的 TTL 选项如下。
nebula> CREATE TAG IF NOT EXISTS t1 (a timestamp);
# ALTER 修改 Tag,添加 TTL 选项。
nebula> ALTER TAG t1 ttl_col = "a", ttl_duration = 5;
nebula> ALTER TAG t1 TTL_COL = "a", TTL_DURATION = 5;
# 插入点,插入后 5 秒过期。
nebula> INSERT VERTEX t1(a) values "101":(now());
nebula> INSERT VERTEX t1(a) VALUES "101":(now());
```

### Tag 或 Edge type 不存在
Expand All @@ -72,10 +72,10 @@ nebula> INSERT VERTEX t1(a) values "101":(now());

```ngql
# 创建 Tag 并设置 TTL 选项。
nebula> CREATE TAG IF NOT EXISTS t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a";
nebula> CREATE TAG IF NOT EXISTS t2(a int, b int, c string) TTL_DURATION= 100, TTL_COL = "a";
# 插入点。过期时间戳为 1648197238(1648197138 + 100)。
nebula> INSERT VERTEX t2(a, b, c) values "102":(1648197138, 30, "Hello");
nebula> INSERT VERTEX t2(a, b, c) VALUES "102":(1648197138, 30, "Hello");
```

## 删除存活时间
Expand All @@ -91,11 +91,11 @@ nebula> INSERT VERTEX t2(a, b, c) values "102":(1648197138, 30, "Hello");
- 设置`ttl_col`为空字符串。

```ngql
nebula> ALTER TAG t1 ttl_col = "";
nebula> ALTER TAG t1 TTL_COL = "";
```

- 设置`ttl_duration``0`。本操作可以保留 TTL 选项,属性永不过期,且属性的 Schema 无法修改。

```ngql
nebula> ALTER TAG t1 ttl_duration = 0;
nebula> ALTER TAG t1 TTL_DURATION = 0;
```

0 comments on commit 9213860

Please sign in to comment.