.alter cluster caching policy 命令

更改群集的缓存策略。 为了加快查询速度,将数据缓存在处理节点、SSD 甚至 RAM 中。 通过缓存策略,群集能够描述其使用的数据项目,从而让更重要的数据占据优先地位。

权限

你必须具有 AllDatabasesAdmin 权限才能运行此命令。

语法

.alterclusterpolicycachingPolicyParameter

详细了解语法约定

参数

客户 类型​​ 必需 说明
PolicyParameter string 一个或多个策略参数。 有关参数,请参阅缓存策略

返回

返回策略的 JSON 表示形式。

示例

以下示例将缓存策略设置为包括过去 30 天。

.alter cluster policy caching hot = 30d

输出

PolicyName EntityName 策略 ChildEntities EntityType
CachingPolicy {"DataHotSpan": { "Value": "30.00:00:00" }, "IndexHotSpan": { "Value": "30.00:00:00"}}

定义热缓存时段

此命令将缓存策略设置为包括过去 30 天的数据以及 2021 年 1 月和 4 月的附加数据。

.alter cluster policy caching 
        hot = 30d,
        hot_window = datetime(2021-01-01) .. datetime(2021-02-01),
        hot_window = datetime(2021-04-01) .. datetime(2021-05-01)

输出

PolicyName EntityName 策略 ChildEntities EntityType
CachingPolicy {"DataHotSpan": { "Value": "30.00:00:00" }, "IndexHotSpan": { "Value": "30.00:00:00" },"HotWindows": [{ "MinValue": "2021-01-01T00:00:00Z", "MaxValue": "2021-02-01T00:00:00Z" }, { "MinValue": "2021-04-01T00:00:00Z", "MaxValue": "2021-05-01T00:00:00Z" }]}