Cache named[users] not found error

2,227 views
Skip to first unread message

arpit agrawal

unread,
Jul 18, 2013, 11:04:33 AM7/18/13
to simple-sprin...@googlegroups.com
I have declared a method as Cacheable using spring cache abstraction as under:

@Cacheable(value="users", key="email", condition="incAddress == false")
public User getUserData(String email, boolean incAddress){
....
}

When I am trying to hit this method I am getting the following error:

annot find cache named [users] for CacheableOperation[public com.lrm.purple.domain.User com.lrm.purple.dao.impl.UserDAOImpl.getUserData(java.lang.String,boolean) throws org.springframework.dao.DataAccessException] caches=[users] | condition='incAddress == false' | key='email'


Do I need to configure the cache named `users` somewhere in my application context or any other configuration files. If yes, how do I configure multiple caches: "users", "deals", "rewards" etc.


I have attached the applicationContext for your reference.
applicationContext.xml

arpit agrawal

unread,
Jul 18, 2013, 11:20:45 AM7/18/13
to simple-sprin...@googlegroups.com
also when I replaced my cachename from to users to 'defaultCache' as declared in applicationContext:

I get the following error:

EL1008E:(pos 0): Field or property 'incAddress' cannot be found on object of type 'org.springframework.cache.interceptor.CacheExpressionRootObject'

Jakub Białek

unread,
Jul 19, 2013, 1:05:09 AM7/19/13
to simple-sprin...@googlegroups.com
In your applicationContext.xml only defaultCache is defined (cacheName property in CacheFactory). 
If you want to define other caches that will:
* point to different memcached servers or use dedicated configuration then define new CacheFactory beans
* point to the same memcached servers and use the same configuration then use cacheAliases property in CacheFactory and provide a list of names

The error EL1008E is because of wrong expression in condition field, it should be "#incAddress == false"

Best regards,
-- Ragnor


--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-meme...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

arpit agrawal

unread,
Jul 19, 2013, 6:17:16 AM7/19/13
to simple-sprin...@googlegroups.com
Thanks for the answer. Actually I figured out the problems later and I've realised Imade silly mistakes and boggled up with them. Anyways, thanks for the answer.


On Thursday, 18 July 2013 20:34:33 UTC+5:30, arpit agrawal wrote:
Reply all
Reply to author
Forward
0 new messages