CacheControl 数据对象

CacheControl 指定在执行操作之前是否应该清除存储库适配器高速缓存以及清除高速缓存的模式。

您可以将 CacheControl 传递到应用程序编程接口 (API) 的 get()、search() 和 update() 方法。LDAP 适配器使用 CacheControl 来清除其高速缓存;由于其他即开即用适配器没有高速缓存,所以它们将忽略 CacheControl。如果您使用定制适配器,可以使用 CacheControl 来实施自己的处理以清除高速缓存。

CacheControl 数据对象包含以下属性:

mode
指定执行操作之前清除存储库适配器高速缓存的模式。
有效值为:
  • clearEntity:清除指定实体的高速缓存。该值对 search() 方法没有任何效果。
  • clearAll:清除适配器中的所有高速缓存信息。
这些值不区分大小写。此属性没有缺省值。如果您没有指定值,或者指定 clearEntity 或 clearAll 之外的值,那么显示错误消息。
Avoid trouble: 经常使用此参数来清除高速缓存可能导致性能降级。 在清除高速缓存时,后续操作必须从存储库获取详细信息并使用新检索的数据来更新高速缓存。如果您使用 clearAll 模式,由于这会使整个高速缓存无效,并且后续操作需要更长时间才能完成,那么对性能的影响会更明显。

XML 模式定义

以下显示了 CacheControl 数据对象的 XML 模式定义:

<xsd:complexType name="CacheControl">
  <xsd:complexContent>
    <xsd:extension base="Control">
      <xsd:sequence>
        <xsd:element name="mode" type="xsd:string" />
      </xsd:sequence>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>

样本数据对象

以下示例显示 CacheControl 数据对象:

<wim:Root>
  <wim:entities xsi:type="wim:PersonAccount">
    <wim:identifier uniqueName="cn=testUser1,dc=yourco,dc=com"/>
  </wim:entities>
  <wim:controls xsi:type="wim:CacheControl">
    <wim:mode>clearEntity</wim:mode>
  </wim:controls>
  <wim:controls xsi:type="wim:PropertyControl">
    <wim:properties>sn</wim:properties>
  </wim:controls>
</wim:Root>


使用条款 | 反馈