添加查询索引
Add-QueryIndex PowerShell cmdlet 允许用户为要添加到缓存中的对象添加查询索引。用户稍后可以使用这些查询索引在缓存中搜索项目。
警告
请确保在执行此 cmdlet 之前已停止缓存。
Add-QueryIndex -CacheName -AssemblyPath `
-Attributes -Class `
[-Server] [-Port] `
[-Credentials] [-NoLogo]
例子
- 此命令在缓存中添加属性 CustomerID 和 FirstName 的查询索引。
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll `
-Class Data.Customer -Attributes CustomerID$FirstName
- 此命令在服务器 20.200.20.11 的缓存中添加 CustomerID 和 FirstName 属性的查询索引。
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll `
-Class Data.Customer -Attributes CustomerID$FirstName `
-Server 20.200.20.11
- 此命令为服务器 20.200.20.11 上的缓存中的属性 CustomerID 和 FirstName 添加基于 JSON 的查询索引,其数据类型分别为 String 和 Integer。
Add-QueryIndex -CacheName demoCache -JsonFilePath C:\data.json `
-Class Data.Customer -Attributes CustomerID$FirstName `
-AttributeTypes Integer$String -Server 20.200.20.11
- 此命令使用安全机制在缓存中添加 CustomerID 和 FirstName 属性的查询索引。 证书.
Add-QueryIndex -CacheName demoCache -AssemblyPath C:\Data.dll `
-Class Data.Customer -Attributes CustomerID$FirstName `
-Credentials(Get-Credential john_smith)
物业
注意:
名称上带有星号 (*) 的参数为必填参数,其余为可选参数。
| 参数 | 数据类型 | 描述 | 默认值 |
|---|---|---|---|
-CacheName* |
<String> |
指定需要对其进行查询索引的缓存的名称。 注意: 缓存必须已经存在于源服务器上。 |
- |
-AssemblyPath* |
<String> |
指定需要配置的程序集的路径。 | - |
-Attributes* |
<String> |
指定查询索引的属性。 如果需要索引多个属性; 它们用“$”分隔。 | - |
-Class* |
<String> |
指定查询索引的完全限定类名。 | - |
-Server |
<String> |
指定服务器名称,其中 NCache 服务正在运行,并且已注册具有指定缓存名称的缓存。 | 本机IP |
-Port |
<Integer> |
指定服务器端口 NCache 服务就是倾听。 | 8250 |
-Credentials |
<pscredential> |
指定授权访问指定操作所需的用户凭据。这些凭据应属于在节点上具有适当权限的用户。 | - |
-NoLogo |
<SwitchParameter> |
禁止显示标志横幅。 | 假 |