Comments (2)
Redis cannot store objects by their Java identity as the storage happens externally by serializing the key into bytes. Also, a JPA specification has no means of being identifiable in any way since it has no key or other details attached. In your case, it is merely a lambda.
If you want to keep using a Specification as key, I suggest that you create a subinterface (or a wrapper type) that accepts a Specification
and a String
(key) in your application. Then you register a Converter
through RedisCacheConfiguration.configureKeyConverters(…)
using the key
from your Specification
wrapper to create a meaningful Redis key.
Let me know how this goes.
from spring-data-redis.
Hi @mp911de !
Thanks for your reply!
Yes, that pretty much that I did. Instead mark repository method as @Cacheable
, I implemented a new layer that wraps repository calls and this layer I marked as @Cacheable
.
So instead we have:
Controller -> Service -> Repository(@Cacheable)
We have:
Controller -> Service -> CacheableRepository(@Cacheable) -> Repository
That would work better as CacheableRepository has one single responsability while Repository remains with database access responsability, in my perspective. :)
Anyways, appreciate your attention as well your suggestion.
Let me know if you have any question.
Take care!
from spring-data-redis.
Related Issues (20)
- Failed to use Java records as projections in Spring Data Redis repository HOT 2
- getClusterConnection.clusterGetNodes always return 1 node HOT 1
- Invalid links on the Overview tab HOT 1
- For GenericJackson2JsonRedisSerializer use custom NullValueSerializer HOT 1
- Let `QueryByExampleRedisExecutor` implement `ListQueryByExampleExecutor` HOT 1
- Index value for `@Index` column not removed after setting value to `null`
- `ReactiveKeyCommands.Exists` to check multiple key existence HOT 4
- is not supported for Redis query derivation HOT 1
- why pipeliningFlushPolicy default is not flushOnClose? HOT 8
- RedisTemplate.hasKey() Behavior Change with setEnableTransactionSupport = true HOT 1
- Pipelined usage of Redis Cluster with Lettuce fails for some commands that return `PipelinedRedisFuture` HOT 3
- `RedisCache.get(Object, Callable)` synchronizes on entire cache instead of individual keys HOT 1
- Release 3.1.12 (2023.0.12)
- Release 3.2.6 (2023.1.6)
- Release 3.3 GA (2024.0.0)
- AWS ElasticCache issue with Config command HOT 1
- Use SET command instead of SETEX HOT 2
- Redis repository: Error while converting to Timestamp HOT 2
- Support Lettuce SSL/TLS Verification Modes HOT 1
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 spring-data-redis.