Files
Backend/src/main/java/xyz/mcutils/backend/model/cache/CachedPlayer.java

40 lines
989 B
Java
Raw Normal View History

2024-04-10 07:43:38 +01:00
package cc.fascinated.model.cache;
2024-04-13 18:15:03 +01:00
import cc.fascinated.common.CachedResponse;
2024-04-10 07:43:38 +01:00
import cc.fascinated.model.player.Player;
import com.fasterxml.jackson.annotation.JsonIgnore;
2024-04-10 07:43:38 +01:00
import lombok.Getter;
2024-04-13 17:17:13 +01:00
import lombok.NoArgsConstructor;
2024-04-10 07:43:38 +01:00
import lombok.Setter;
import org.springframework.data.annotation.Id;
2024-04-10 07:43:38 +01:00
import org.springframework.data.redis.core.RedisHash;
import java.io.Serializable;
import java.util.UUID;
/**
* A cacheable {@link Player}.
*
* @author Braydon
*/
@Setter @Getter
2024-04-13 17:17:13 +01:00
@NoArgsConstructor
2024-04-10 07:43:38 +01:00
@RedisHash(value = "player", timeToLive = 60L * 60L) // 1 hour (in seconds)
2024-04-13 18:02:46 +01:00
public class CachedPlayer extends CachedResponse implements Serializable {
2024-04-10 07:43:38 +01:00
/**
* The unique id of the player.
2024-04-10 07:43:38 +01:00
*/
@JsonIgnore
@Id private UUID uniqueId;
2024-04-10 07:43:38 +01:00
/**
* The player to cache.
*/
private Player player;
2024-04-13 17:17:13 +01:00
public CachedPlayer(UUID uniqueId, Player player) {
2024-04-13 18:15:03 +01:00
super(Cache.defaultCache());
2024-04-13 17:17:13 +01:00
this.uniqueId = uniqueId;
this.player = player;
}
2024-04-10 07:43:38 +01:00
}