Comments (4)
Of course.
I have a service with a method like this:
@Cacheable(value = "dataServiceCache.vehicleByLabelAndCompanyId", condition = "#result != null")
Vehicle findVehicleByLabelAndCompanyId(String label, long companyId) {
}
Now, with version 4, I have no way to do it using the condition closure.
I don't want to cache null values because, in the exemple, the vehicle may be inserted at some point, and the method will continue to return null.
Also, IMHO, I think it should be nice to keep this kind of compatibility with the previous version.
from grails-cache.
I don't understand the use case. Can you put together a more concrete example?
from grails-cache.
This could help with transitioning to newer versions of Grails that use ehcache 3. Version 2 allows null values, but 3 does not.
I think that Grails' Cacheable
should try to follow Spring's. The solution would therefore be to add unless
to mirror Spring's unless
, in which "Unlike condition(), this expression is evaluated after the method has been called and can therefore refer to the result."
from grails-cache.
The problem wasn't solved. If somebody came here with the same problem: solution that works for me is to override Ehcache.java file and add
if(value == null) { putObserver.end(PutOutcome.NOOP); }
Into put method
from grails-cache.
Related Issues (20)
- CustomCacheKeyGenerator key generator not hashing class or method names or params
- Lots of unneeded dependencies in war due to gpars HOT 3
- Update documentation to automatically generate list of version or drop-down
- Dependency Dashboard
- Grails 4 project gets error when built against plugin v.5.0 Failed to initialize class [com.demo.DemoController] HOT 4
- Version 5.0.0 & 5.0.1 has gsp views compiled into the jar file HOT 1
- V6.0.0 needs to exclude the logback.xml from the jar file
- Publish version 6.0.0 for Grails 5 HOT 1
- CustomCacheKeyGenerator does not work as aspected since v4.0.1
- @cacheable in controller actions shouldn't do anything
- Location of documentation page for grails-cache 1.1.8 HOT 1
- Migrate to Develocity build cache connector
- Integration Tests fails with java.lang.NoClassDefFoundError
- NoClassDefFoundError: FilterRegistrationBean error HOT 2
- Cache Configuration for Limiting Entries Fails on Startup HOT 4
- Error in GrailsConcurrentLinkedMapCache.put when excluding null values (v 4.0.0)
- Closure for creating key has an issue when used with @Transactional annotation
- Cache Configuration for Limiting Entries not working in v5.0.0.RC1 HOT 1
- Documentation not available for the 1.x version (Grails 2.x)
- There is no documentation for version 5 of this plugin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grails-cache.