Pages enfant
  • 3.18.2 Gestion du cache (utilisation des annotations)

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

Exemple de l'intégration de la gestion du cache via les annotations ehcache pour Spring dans esup-commons-v2

Gestion des dépendances

Ajouter une dépendance dans le domain-service de l'application (fichier : appli-domain-services/pom.xml)

...

Bloc de code
<?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:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                            http://www.springframework.org/schema/aop
                            http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                            http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring
                            http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">


        <!--
            /properties/cache/cache.xml
            The configuration file for caching features.
            This file should not be modified but by the developers.
            This file is referenced by /properties/applicationContext.xml.
        -->


        <ehcache:annotation-driven/>

        <aop:config proxy-target-class="true" />

        <bean id="cacheManager"
             >
            <description>
                This bean is used to configure EhCache.
            </description>
            <property name="configLocation" value="classpath:/properties/cache/ehcache.xml" />
        </bean>

    </beans>   

    
La configuration du cache se paramètre via le fichier de configuration ehcache.xml.  Ces paramètres sont accessibles depuis la documentation du framework ehCache : http://ehcache.org/documentation/configuration.html

...