3

何らかの理由で、ehcache3 構成 xml に expiry 要素を追加できません。有効期限要素がなければ、正常に機能します。

  <config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns='http://www.ehcache.org/v3'
    xmlns:jsr107='http://www.ehcache.org/v3/jsr107'>

  <service>
    <jsr107:defaults>
      <jsr107:cache name="people" template="heap-cache"/>
    </jsr107:defaults>
  </service>

  <cache-template name="heap-cache">
    <listeners>
        <listener>
          <class>org.terracotta.ehcache.EventLogger</class>
          <event-firing-mode>ASYNCHRONOUS</event-firing-mode>
          <event-ordering-mode>UNORDERED</event-ordering-mode>
          <events-to-fire-on>CREATED</events-to-fire-on>
          <events-to-fire-on>UPDATED</events-to-fire-on>
          <events-to-fire-on>EXPIRED</events-to-fire-on>
          <events-to-fire-on>REMOVED</events-to-fire-on>
          <events-to-fire-on>EVICTED</events-to-fire-on>
        </listener>
    </listeners>
     <expiry>
        <ttl unit="seconds">10</ttl>
    </expiry>
    <resources>
      <heap unit="entries">2000</heap>
      <offheap unit="MB">100</offheap> <!-- unit of measure is case sensitive! -->
    </resources>
  </cache-template>
</config>

エラーメッセージは次のとおりです。

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'expiry'. One of '{"http://www.ehcache.org/v3":heap, "http://www.ehcache.org/v3":resources, "http://www.ehcache.org/v3":heap-store-settings, "http://www.ehcache.org/v3":disk-store-settings, "http://www.ehcache.org/v3":service-configuration}' is expected.

しかし、この xsd を見ると: http://www.ehcache.org/schema/ehcache-core.xsd タグに問題はありません。

4

3 に答える 3