diff --git a/src/main/java/org/springframework/data/aerospike/cache/AerospikeCacheKey.java b/src/main/java/org/springframework/data/aerospike/cache/AerospikeCacheKey.java index 86a80a6ba..e4542d7c8 100644 --- a/src/main/java/org/springframework/data/aerospike/cache/AerospikeCacheKey.java +++ b/src/main/java/org/springframework/data/aerospike/cache/AerospikeCacheKey.java @@ -4,7 +4,7 @@ import lombok.Getter; /** - * Wrapper class used for caching with methods that receive either a String or a long number + * Wrapper class used in caching. Receives hash of the cache key as a String, a long number or a byte array. */ public class AerospikeCacheKey { @@ -19,6 +19,10 @@ private AerospikeCacheKey(long number) { this.value = new Value.LongValue(number); } + private AerospikeCacheKey(byte[] data) { + this.value = new Value.BytesValue(data); + } + /** * Instantiate AerospikeCacheKey instance with a String. * @@ -38,4 +42,15 @@ public static AerospikeCacheKey of(String string) { public static AerospikeCacheKey of(long number) { return new AerospikeCacheKey(number); } + + /** + * Instantiate AerospikeCacheKey instance with a byte array. + * + * @param data byte array + * @return new instance of AerospikeCacheKey initialized with the given parameter + */ + public static AerospikeCacheKey of(byte[] data) { + return new AerospikeCacheKey(data); + } + }