Spring + memcached save after startup

117 views Asked by At

I've a method like this

    @Transactional
    @Cacheable(value="defaultCache")
    public List<NewEntityModel> getClassesFromOntologyByJena() {
............
    }

And I've configured memcached in corret way beacuse whene I call this method as a service all fire good, and all values are stored into cache. I would lunch this one at startup of my servlet after memchacedmanager is read, so I've configured one of my bean in this way

<bean name="defaultCache" class="com.google.code.ssm.CacheFactory">
        <property name="cacheName" value="defaultCache" />
        <property name="cacheClientFactory">
            <bean name="cacheClientFactory"
                class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
        </property>
        <property name="addressProvider">
            <bean class="com.google.code.ssm.config.DefaultAddressProvider">
                <property name="address" value="127.0.0.1:11211" />
            </bean>
        </property>
        <property name="configuration">
            <bean class="com.google.code.ssm.providers.CacheConfiguration">
                <property name="consistentHashing" value="true" />
            </bean>
        </property>
    </bean>

    <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />

    <bean id="owlFunctionsService" class="***.******.********.service.OwlFunctionServiceImpl" init-method="getClassesFromOntologyByJena" depends-on="defaultCache"/>

All is correct and my sarvlet stars, but into phpMemcached there isn't stored any. Any suggestions?

0

There are 0 answers