Announcement Announcement Module
Collapse
No announcement yet.
Performance Issues and Cache Set-up Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Performance Issues and Cache Set-up

    I am experiencing performance problems while user log in in my application using acegi. I would like to know how to set-up Ehcache for authentication. I am using hibernate, and already set-up ehcache for my daos. Is there any guide or blog post you can recommend on seting-up ehcache for authentication with acegi?

  • #2
    Quoting http://acegisecurity.sourceforge.net...-provider-dao:

    <bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthe nticationProvider">
    <property name="authenticationDao"><ref bean="authenticationDao"/></property>
    <property name="userCache"><ref bean="userCache"/></property>
    </bean>

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheMa nagerFactoryBean">
    <property name="configLocation">
    <value>classpath:/ehcache-failsafe.xml</value>
    </property>
    </bean>

    <bean id="userCacheBackend" class="org.springframework.cache.ehcache.EhCacheFa ctoryBean">
    <property name="cacheManager">
    <ref local="cacheManager"/>
    </property>
    <property name="cacheName">
    <value>userCache</value>
    </property>
    </bean>

    <bean id="userCache" class="net.sf.acegisecurity.providers.dao.cache.Eh CacheBasedUserCache">
    <property name="cache"><ref local="userCacheBackend"/></property>
    </bean>

    Comment


    • #3
      Thanks for replying Ben. It seems to fail with my code, my UserDao implementation uses Hibernate and lazy fetching which requires me to keep the hibernate session alive during requests, this is accomplished by a filter configured in my web.xml. When i tried this configuration the dao fails "lazily" retrieving the user because appearently the filter doesn't work. Do you have any ideas regarding this issue?

      Thanks

      Comment


      • #4
        Take a look at http://forum.springframework.org/showthread.php?t=14450 which discusses how to integrate Hibernate returned objects into your UserDetails. You should be returning from AuthenticationDao a fully initialized (eagerly fetched) object, such that further Hibernate lazy fetching is unnecessary. Then the UserDetails can be safely stored within the caching layer and used as described above.
        Last edited by robyn; May 16th, 2006, 03:31 AM.

        Comment


        • #5
          Thanks for the advice. It now works propperly.

          Comment

          Working...
          X