package com.jarvis.cache.to;

import lombok.Data;

import java.io.Serializable;

/**
 * 缓存Key
 *
 *
 */
@Data
public final class CacheKeyTO implements Serializable {

    private static final long serialVersionUID = 7229320497442357252L;

    private final String namespace;

    private final String key;// 缓存Key

    private final String hfield;// 设置哈希表中的字段，如果设置此项，则用哈希表进行存储

    public CacheKeyTO(String namespace, String key, String hfield) {
        this.namespace = namespace;
        this.key = key;
        this.hfield = hfield;
    }

    public String getCacheKey() {
        if (null != this.namespace && this.namespace.length() > 0) {
            return new StringBuilder(this.namespace).append(":").append(this.key).toString();
        }
        return this.key;
    }

    public String getLockKey() {
        StringBuilder key = new StringBuilder(getCacheKey());
        if (null != hfield && hfield.length() > 0) {
            key.append(":").append(hfield);
        }
        key.append(":lock");
        return key.toString();
    }

    public String getNamespace() {
        return namespace;
    }

    public String getHfield() {
        return hfield;
    }
}

@@ -34,49 +34,54 @@
 ort 
-lombok.Data;%0A%0Aimport java.io.Serializable
+java.io.Serializable;%0Aimport java.util.Objects
 ;%0A%0A/
@@ -106,14 +106,8 @@
  */%0A
-@Data%0A
 publ
@@ -1173,10 +1173,725 @@
 ;%0A    %7D%0A
+    %0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A        CacheKeyTO that = (CacheKeyTO) o;%0A        return Objects.equals(namespace, that.namespace) &&%0A                Objects.equals(key, that.key) &&%0A                Objects.equals(hfield, that.hfield);%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(namespace, key, hfield);%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22CacheKeyTO%7B%22 +%0A                %22namespace='%22 + namespace + '%5C'' +%0A                %22, key='%22 + key + '%5C'' +%0A                %22, hfield='%22 + hfield + '%5C'' +%0A                '%7D';%0A    %7D%0A
 %7D%0A

Update CacheKeyTO.java