0

grails バージョン 3.3.1 cache-ehcache:3.0.0.M1

誰かが私に有効なものを送ってくれませんehcache.xmlか?

私のファイルは次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="ehcache.xsd"
     updateCheck="true"
     monitoring="autodetect"
     dynamicConfig="true">

    <diskStore path="java.io.tmpdir"/>

    <cache name="sevenSeconds"
       maxEntriesLocalHeap="100"
       maxEntriesLocalDisk="1000"
       eternal="false"
       timeToLiveSeconds="7"
       timeToIdleSeconds="0"
       memoryStoreEvictionPolicy="LFU"
       transactionalMode="off">
       <persistence strategy="localTempSwap" />
    </cache>

    <defaultCache
        maxElementsInMemory="50000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="true"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120"
        memoryStoreEvictionPolicy="LRU"
    />
</ehcache>

起動中に次のエラーが表示されます。

Caused by: org.ehcache.xml.exceptions.XmlConfigurationException: Error parsing XML configuration at file:/home/user/workspaces/api2-grails/grails-app/conf/ehcacheCustom.xml
Caused by: org.xml.sax.SAXParseException: cvc-elt.1.a: Cannot find the declaration of element 'ehcache'.

提案をありがとう

4

2 に答える 2

1

ehcache 3.0.0 以降、xml 形式が変更されました。これは私の基本バージョンです:

<?xml version="1.0" encoding="UTF-8"?>       
<config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.ehcache.org/v3'
xsi:schemaLocation="ehcache-core.xsd">
    <persistence directory="java.io.tmpdir"/>
    <cache alias="twentySeconds">
        <expiry>
            <ttl unit="seconds">20</ttl>
        </expiry>
        <heap>2</heap>
    </cache>
</config>
于 2018-07-09T10:46:28.867 に答える