1 package com.atlassian.vcache.internal.redis;
2
3 import com.atlassian.vcache.CasIdentifier;
4
5 import javax.annotation.Nullable;
6 import java.util.Arrays;
7
8 import static java.util.Objects.requireNonNull;
9
10
11
12
13
14
15 class RedisCasIdentifier implements CasIdentifier {
16 private final byte[] value;
17
18 RedisCasIdentifier(byte[] value) {
19 this.value = requireNonNull(value);
20 }
21
22 byte[] getValue() {
23 return value;
24 }
25
26 @Override
27 public boolean equals(@Nullable Object o) {
28 if (this == o) {
29 return true;
30 }
31 if (!(o instanceof RedisCasIdentifier)) {
32 return false;
33 }
34
35 final RedisCasIdentifier that = (RedisCasIdentifier) o;
36
37 return Arrays.equals(value, that.value);
38
39 }
40
41 @Override
42 public int hashCode() {
43 return Arrays.hashCode(value);
44 }
45 }