-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Provide reusable parts of Cache implementation for others [SPR-12622] #17223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Stéphane Nicoll commented Could you please describe what you copy/pasted instead because I am not sure I am following. What the cache abstraction provides is a way to cache a method so that the SpEL expression is not computed every time (it's computed the first time it's actually used and reused later). I don't see the link with your description, sorry. |
Stéphane Nicoll commented Hello, can you please clarify? |
cemo koc commented Sorry Stephane, I was very busy past week and splitting necessary parts from our repository to provide a sample is not easy. Hope you provide this week. |
Stéphane Nicoll commented I don't necessary need a sample that I can run. I don't understand what pieces you're talking about so having more explanation about that would help. |
cemo koc commented Since Spring 4.1 Cache implementation of Spring has changed a lot. I am having difficulties to correspond some old classes with new one. Let me to explain clearly what I want with current 4.1 implementation. Basically I want to create a EvaluationContext as Spring Cache has done. I am talking about specifically, org.springframework.cache.interceptor.CacheEvaluationContext in 4.1 which is package protected currently. I would be glad that if CacheEvaluationContext can be renamed to something more generic and move to another package to be reused by others. There are pretty much related classes such as "org.springframework.cache.interceptor.ExpressionEvaluator". For example, org.springframework.cache.interceptor.MethodCacheKey is part of cache package which is very suitable to store in a more common package. |
Stéphane Nicoll commented That clarifies the scope, thanks! |
Stéphane Nicoll commented
As for the context, it is very cache specific and sharing that publicly is not going to add much more to it I am afraid. I'd recommend to inspire yourself from that class and tailor it for your specific needs. |
Stéphane Nicoll commented Maybe adding |
cemo koc commented I will give a try with latest trunk and inform you about details until weekend. I am hoping a sample demo project for others as well. |
Stéphane Nicoll commented Alright, I gave a bit more love in something related. Check MethodBasedEvaluationContext It has not landed in master yet but the plan is to merge that as part of 4.2 as well. I think it should be interesting for you as well. Let me know if the current contract requires an additional hook point. Thanks! |
cemo koc opened SPR-12622 and commented
This issue is a complementary issue to #16245.
It seems that preliminary implementation of Annotation-based Event Listeners is sharing a great amount of code with Cache part of Spring. In our projects we had to duplicated necessary parts as Stéphane Nicoll has done.
My use cases:
My first use case was about
@Audit
. We wanted to track necessary actions in some controllers for audit trailing. It can access parameters, request, response etc... as in done Cache annotations.My second use case was relatively simple to first one. We wanted to declaratively to track some product views, clicks etc... We created another annotation,
@Track
. It was also creating a context to access context parameters.I would be glad to if necessary changes will be provided by means of #16245.
Affects: 4.1.4
Issue Links:
Referenced from: commits c7b324b
The text was updated successfully, but these errors were encountered: