Browse Source
Merge pull request #11458 from thingsboard/fix/versioned-cache
Fix getOrFetchFromDB for versioned transactional cache
pull/11466/head
Viacheslav Klimov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
2 deletions
-
common/cache/src/main/java/org/thingsboard/server/cache/TbTransactionalCache.java
|
|
|
@ -53,7 +53,7 @@ public interface TbTransactionalCache<K extends Serializable, V extends Serializ |
|
|
|
if (putToCache) { |
|
|
|
return getAndPutInTransaction(key, dbCall, cacheNullValue); |
|
|
|
} else { |
|
|
|
TbCacheValueWrapper<V> cacheValueWrapper = get(key); |
|
|
|
TbCacheValueWrapper<V> cacheValueWrapper = get(key, true); |
|
|
|
if (cacheValueWrapper != null) { |
|
|
|
return cacheValueWrapper.get(); |
|
|
|
} |
|
|
|
@ -92,7 +92,7 @@ public interface TbTransactionalCache<K extends Serializable, V extends Serializ |
|
|
|
if (putToCache) { |
|
|
|
return getAndPutInTransaction(key, dbCall, cacheValueToResult, dbValueToCacheValue, cacheNullValue); |
|
|
|
} else { |
|
|
|
TbCacheValueWrapper<V> cacheValueWrapper = get(key); |
|
|
|
TbCacheValueWrapper<V> cacheValueWrapper = get(key, true); |
|
|
|
if (cacheValueWrapper != null) { |
|
|
|
var cacheValue = cacheValueWrapper.get(); |
|
|
|
return cacheValue == null ? null : cacheValueToResult.apply(cacheValue); |
|
|
|
|