You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the docs here: The cache will be treated as a read/write cache, meaning objects retrieved are not shared and can be safely modified by the caller, without interfering with other potential modifications by other callers or threads.
I think this is highly confusing.
Usually:
Read-Cache: Query once, read multiple times
Write-Cache: Write into buffer, flush later
R/W-Cache: Do both, often without invalidation on writes (reading buffered writes)
How does the latter entail that [...] objects retrieved are not shared and can be safely modified by the caller [...]?
This is just a wording thing.
My actual problem is modification - the data in the cache seems mutable (contrary to what is stated in the docs):
Then TaskService::getTasks is idempotent, suggesting some weird connection between immutability and the (write) cache behavior.
There shouldn't at all - we didn't write anything here.
Is there an explanation?
The text was updated successfully, but these errors were encountered:
I think you understand the doc correctly, but there also is a NOTE on that page:
Second level cache is transactional. That means that it is updated when a SqlSession finishes with commit or when it finishes with rollback but no inserts/deletes/updates with flushCache=true where executed.
Your code probably modifies the result before it gets cached.
If you call taskMapper.findTasks() beforehand (during startup, for example, just to cache unmodified results), modification by foo() won't affect the already-cached objects.
Hello.
According to the docs here:
The cache will be treated as a read/write cache, meaning objects retrieved are not shared and can be safely modified by the caller, without interfering with other potential modifications by other callers or threads.
I think this is highly confusing.
Usually:
How does the latter entail that [...] objects retrieved are not shared and can be safely modified by the caller [...]?
This is just a wording thing.
My actual problem is modification - the data in the cache seems mutable (contrary to what is stated in the docs):
Here, if
foo(..)
is not idempotent,TaskService::getTasks
won't be either.If we set the
readWrite
prop tofalse
(previously defaulted totrue
):Then
TaskService::getTasks
is idempotent, suggesting some weird connection between immutability and the (write) cache behavior.There shouldn't at all - we didn't write anything here.
Is there an explanation?
The text was updated successfully, but these errors were encountered: