Caching Techniques using spring AOP

<!– Implementation of Data Service & Caching Advice : –>
<aop:config>
<!– Data Caching Advice –>
<aop:advisor id=”referenceCachingAdvisor” pointcut=”execution(* com.interface101.xml.impl.ReferenceDataImpl.getReferenceData(..))”
advice-ref=”methodCachingAdvice” />
</aop:config>

<bean id=”methodCachingAdvice”>
<property name=”cache”>
<ref local=”methodCache” />
</property>
</bean>
<!– Begin Cache Configuration –>
<bean id=”cacheManager”>
<property name=”configLocation”>
<value>classpath:ehcache.xml</value>
</property>
<property name=”shared”>
<value>true</value>
</property>
</bean>
<bean id=”methodCache”>
<property name=”cacheManager”>
<ref local=”cacheManager” />
</property>
<property name=”cacheName”>
<value>cache.REFERENCE_DATA_CACHE</value>
</property>
</bean>

Advertisements

2 Comments »

  1. Josh Lupotokin said

    We have implemented the Ehcache solution for caching within our product, we manage to inject the cache manager of Ehcache entirely using your code in our spring’s application context XML which worked great.

    Thank you for sharing the code.

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: