Skip to content

Commit

Permalink
Removed the hashCode() check from Cache and CachedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
jskupsik committed Dec 19, 2024
1 parent eaaed2f commit 3d54cb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/main/groovy/io/xh/hoist/cache/Cache.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,18 @@ class Cache<K, V> implements LogSupport {
// Implementation
//------------------------
Map getAdminStats() {
def hashCode = _map?.hashCode(),
ret = [
[
name : name,
type : 'Cache' + (replicate ? ' (replicated)' : ''),
count : size(),
latestTimestamp: _map.max { it.value.dateEntered }?.value?.dateEntered,
hashCode : hashCode ? HexFormat.of().toHexDigits(hashCode) : null,
lastCullTime : cullTimer.lastRunCompleted
]
return ret
}

List getComparisonFields() {
if (!replicate) return null
return ['count', 'latestTimestamp', 'hashCode']
return ['count', 'latestTimestamp']
}

Logger getInstanceLog() {
Expand Down
5 changes: 1 addition & 4 deletions src/main/groovy/io/xh/hoist/cachedvalue/CachedValue.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,11 @@ class CachedValue<V> implements LogSupport {
LoggerFactory.getLogger(loggerName)
}


Map getAdminStats() {
def val = get(),
hashCode = val?.hashCode(),
ret = [
name : name,
type : 'CachedValue' + (replicate ? ' (replicated)' : ''),
hashCode : hashCode ? HexFormat.of().toHexDigits(hashCode) : null,
timestamp: timestamp
]
if (val instanceof Collection || val instanceof Map) {
Expand All @@ -247,7 +244,7 @@ class CachedValue<V> implements LogSupport {
if (!replicate) return null

def val = get(),
ret = ['timestamp' , 'hashCode']
ret = ['timestamp']
if (val instanceof Collection || val instanceof Map) {
ret << 'size'
}
Expand Down

0 comments on commit 3d54cb1

Please sign in to comment.