This project is read-only.
1

Closed

Integration Questions

description

hi,
this is awesome library, could you please explain the following for me
  • i use ravendb, and it has cache mechanism too, so if i have a method called
[CacheableMethod(30)]
public virtual List<User>GetUsers(int id){

return ravenSession.Query<User>().ToList();

}
what will happen? if the id does not change the method body wont get executed?

-how does cache invalidation works? based on time, is there a way to customize it, is there a way to enforce cache invalidation ?
  • you mentioned in the Docs "Keep the number of parameters on cacheable methods down if at all possible"
does that mean if i have method like this, it wont be cached ?
[CacheableMethod(30)]
public virtual List<User>GetUsers(int id, string userName, int age, string sortOrder){

return ravenSession.Query<User>().ToList();

}

thank you very much in advanced.
Closed Jun 24, 2013 at 11:52 AM by MikeGoatly
Closing as this is more of a discussion, not an issue.

comments

MikeGoatly wrote Jun 24, 2013 at 11:52 AM

Hi - sorry for the delay getting back to you - I hadn't noticed the issue being raised.

This is probably more of a discussion thing, but I'll answer the question here and close it off. If you have further questions I would recommend using the discussions area.
  • GetUsers(int id): The first time you make a call to the method with an ID (let's use 3 as an example), then the body will be called and the results put in the cache. If subsequent calls with ID 3 are made while the data is still available in the cache then the method body will not be called.
  • Cache invalidation: It's time based only at the moment. Happy to talk about other requirements around this though.
  • GetUsers(int, string, int, string): This will work, however each of the parameters contributes to the cache key, so unless you make multiple calls with exactly the same parameters then you won't benefit from caching. I've you've ever used ASP.NET page output caching's VaryByParam, the same rules apply there because it's the same principle.
Cheers,
Mike

wrote Jun 24, 2013 at 11:52 AM