spring-cache.xml 3.49 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1 2
<?xml version="1.0" encoding="UTF-8"?>
<!--
Matija Obreza's avatar
Matija Obreza committed
3
  Copyright 2014 Global Crop Diversity Trust
Matija Obreza's avatar
Matija Obreza committed
4 5 6 7 8 9 10 11 12 13 14 15 16
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
    http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
Matija Obreza's avatar
Matija Obreza committed
17

Matija Obreza's avatar
Matija Obreza committed
18
<beans xmlns="http://www.springframework.org/schema/beans"
19 20 21
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache"
	xmlns:hz="http://www.hazelcast.com/schema/spring"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
Matija Obreza's avatar
Matija Obreza committed
22 23
                           http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                           http://www.springframework.org/schema/cache
24 25 26
                           http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
                           http://www.hazelcast.com/schema/spring
			               http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd">
Matija Obreza's avatar
Matija Obreza committed
27

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
	<cache:annotation-driven cache-manager="cacheManager" />

	<bean name="cacheManager"
		class="org.springframework.cache.support.CompositeCacheManager">
		<property name="cacheManagers">
			<list>
				<!--If it is turned on, no op cache is being used -->
				<ref bean="hzCacheManager" />
			</list>
		</property>
		<property name="fallbackToNoOpCache" value="true" />
	</bean>

	<beans profile="aws">
		<hz:hazelcast id="theHazelcast">
			<hz:config>
				<hz:group name="${hazelcast.name}" password="${hazelcast.password}" />
				<hz:properties>
					<hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property>
					<hz:property name="hazelcast.merge.next.run.delay.seconds">5</hz:property>
				</hz:properties>

				<hz:network port="${hazelcast.port}" port-auto-increment="true">
					<hz:join>
						<hz:multicast enabled="false" />
						<hz:tcp-ip enabled="true" />
						<hz:aws access-key="${hazelcast.aws.access-key}" region="${hazelcast.aws.region}"
							secret-key="${hazelcast.aws.secret-key}" security-group-name="${hazelcast.aws.security-group}" />
					</hz:join>
				</hz:network>
				<hz:map name="default" max-idle-seconds="3600" max-size="5000" time-to-live-seconds="0" eviction-policy="LRU" />
			</hz:config>
		</hz:hazelcast>

		<bean id="hzCacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">
			<constructor-arg ref="theHazelcast" />
		</bean>
	</beans>
	

	<beans profile="dev">
		<hz:hazelcast id="theHazelcast">
			<hz:config>
				<hz:group name="${hazelcast.name}" password="${hazelcast.password}" />
				<hz:properties>
					<hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property>
					<hz:property name="hazelcast.merge.next.run.delay.seconds">5</hz:property>
				</hz:properties>
				<hz:network port="${hazelcast.port}">
					<hz:join>
						<hz:multicast enabled="false" />
						<hz:tcp-ip enabled="false" />
					</hz:join>
				</hz:network>
				<hz:map name="default" max-idle-seconds="300" max-size="1000" time-to-live-seconds="0" eviction-policy="LRU" />
			</hz:config>
		</hz:hazelcast>

		<bean id="hzCacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">
			<constructor-arg ref="theHazelcast" />
		</bean>
	</beans>
Matija Obreza's avatar
Matija Obreza committed
90 91

</beans>