The specified effect of CompleteConfiguration.isWriteThrough is not being tested via the TCK, and probably not really implemented like the spec says by caching providers.
In JCache its possible to define a loader that will be used in case of loadAll is invoked, and, in case readThrough is enabled the loader is invoked automatically in case a mapping is missing.
Consequently there is the possibility to define a writer and enable write through via CompleteConfiguration.isWriteThrough. However, there are actually no explicitly defined semantics for the case that the writer is defined but write through is not enabled.
In the cache2k JSR107 implementation I simply ignore the write through flag. That means that the TCK does not require write through to be enabled for the write through tests.
There is no test or defined behavior for the illegal configuration of write through being enabled but no writer defined. Checking the RI code I assume it crashes with NPE on Cache.put but does proceed normally on Cache.putAll.
Two options to mitigate this irritation:
Deprecate and make clear that CompleteConfiguration.isWriteThrough has no effect and can be ignored and the write through is enabled via defining a writer.
Improve the TCK and RI that isWriteThrough must be enabled, and add tests for the invalid configuration
I recommend doing 1, because option 2 would mean that implementations and applications have to change without any benefit.
The specified effect of
CompleteConfiguration.isWriteThrough
is not being tested via the TCK, and probably not really implemented like the spec says by caching providers.In JCache its possible to define a loader that will be used in case of
loadAll
is invoked, and, in casereadThrough
is enabled the loader is invoked automatically in case a mapping is missing.Consequently there is the possibility to define a writer and enable write through via
CompleteConfiguration.isWriteThrough
. However, there are actually no explicitly defined semantics for the case that the writer is defined but write through is not enabled.In the cache2k JSR107 implementation I simply ignore the write through flag. That means that the TCK does not require write through to be enabled for the write through tests.
There is no test or defined behavior for the illegal configuration of write through being enabled but no writer defined. Checking the RI code I assume it crashes with NPE on
Cache.put
but does proceed normally onCache.putAll
.Two options to mitigate this irritation:
CompleteConfiguration.isWriteThrough
has no effect and can be ignored and the write through is enabled via defining a writer.isWriteThrough
must be enabled, and add tests for the invalid configurationI recommend doing 1, because option 2 would mean that implementations and applications have to change without any benefit.