Record Class WPCacheKeySnapshot<V>
java.lang.Object
java.lang.Record
net.ygbstudio.powerwp4j.models.entities.WPCacheKeySnapshot<V>
- Type Parameters:
V- the type of the values in the cache subkey map. It is useful to think of this parameter as the kind of transformation that you apply to the cache subkeys. For example,JsonNode::asStringwill require aWPCacheKeySnapshot<String>.- Record Components:
cacheKey- the cache key represented by theCacheKeyEnumenumcacheSubKeyMap- a map containing the cache subkeys represented byCacheSubKeyEnumand their corresponding values of typeV.
public record WPCacheKeySnapshot<V>(CacheKeyEnum cacheKey, Map<CacheSubKeyEnum,@Nullable V> cacheSubKeyMap)
extends Record
WPCacheKeySnapshot is a record that represents a snapshot of a cache key and its subkeys. Use
this abstraction if you are getting nested values and a key exists. If the values are contained
in an array or immediate value (not inside another JSON object), you can use
WPCacheAnalyzer.getCacheKeyValueStream(CacheKeyEnum)
Consumers must be wary that values in the subkey map can be null.
-
Constructor Summary
ConstructorsConstructorDescriptionWPCacheKeySnapshot(CacheKeyEnum cacheKey, Map<CacheSubKeyEnum, @Nullable V> cacheSubKeyMap) Creates an instance of aWPCacheKeySnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncacheKey()Returns the value of thecacheKeyrecord component.Map<CacheSubKeyEnum, @Nullable V> Returns the value of thecacheSubKeyMaprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
WPCacheKeySnapshot
Creates an instance of aWPCacheKeySnapshotrecord class.- Parameters:
cacheKey- the value for thecacheKeyrecord componentcacheSubKeyMap- the value for thecacheSubKeyMaprecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
cacheKey
Returns the value of thecacheKeyrecord component.- Returns:
- the value of the
cacheKeyrecord component
-
cacheSubKeyMap
Returns the value of thecacheSubKeyMaprecord component.- Returns:
- the value of the
cacheSubKeyMaprecord component
-