<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:orm="http://www.zfoo.com/schema/orm"

       xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd


    http://www.zfoo.com/schema/orm
    http://www.zfoo.com/schema/orm-1.0.xsd">

    <context:property-placeholder location="classpath:deploy-dev.properties"/>

    <context:component-scan base-package="com.zfoo.orm"/>

    <orm:orm id="ormManager" entity-package="com.zfoo.orm.**.entity">

        <orm:host database="${mongodb.database}" user="${mongodb.user}" password="${mongodb.password}">
            <orm:address name="${mongodb.address.name}" url="${mongodb.address.url}"/>
        </orm:host>

        <!-- 缓存策略 -->
        <orm:caches>
            <orm:cache strategy="default" size="6000" expire-millisecond="60000"/>
            <orm:cache strategy="hundred" size="100" expire-millisecond="60000"/>
            <orm:cache strategy="thousand" size="1000" expire-millisecond="60000"/>
            <orm:cache strategy="threeThousand" size="3000" expire-millisecond="60000"/>
        </orm:caches>

        <!-- 持久化策略 -->
        <orm:persisters>
            <orm:persister strategy="default" type="time" config="30000"/>
            <orm:persister strategy="cron30s" type="cron" config="0/30 * * * * ?"/>
            <orm:persister strategy="time30s" type="time" config="30000"/>
        </orm:persisters>
    </orm:orm>

</beans>
