tags:

views:

36

answers:

1

I want to cache an dto, that I get consuming an api, in the whole request. I try to access the request variable in a service, but it don't work.

Also I had tried to create a service with request scope but it has a error in bean creation stage in spring.

Some thing like this: http://jira.codehaus.org/browse/GRAILS-4148

Can you give me any pointer?

A: 
  1. request variable presents only in controllers.
  2. You have an error because your program has no idea how to initialize request variable in service.

You are free to pass request variable to any service method as parameter.

You have 2 cache solution:

  1. Use EhCache to cache hibernate queries.
  2. Use SpringCache to cache entire methods(returned result).

P.S. I'm not a big expert in EhCache + Grails bundle but on my opinion - SprigCache is much more flexible (adjustable) than EhCache but those two providers have very different use purposes. And keep in mind that SpringCache is based on EhCache :)

Olexandr
Ehcache puts a dynamic proxy in the middle. And the stacktrace in grails is prety unclear already. I am looking for something more explicit, and I don't mind to have to write some code.
damian
Also the object that I get isn't in the local DB, its consuming a rest api.
damian
I've been reading the documentation for ehcache. I am going to use ehcache but without Spring IOC, thanks
damian