impl birthday feature

This commit is contained in:
Lee
2024-06-26 12:19:11 +01:00
parent e7159ad514
commit 6d593246e8
25 changed files with 589 additions and 47 deletions

View File

@ -12,6 +12,7 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
@ -37,7 +38,7 @@ public class GuildService extends ListenerAdapter {
* @param id The ID of the guild
* @return The guild
*/
@Cacheable(cacheNames = {"guilds"}, key = "#id")
// @Cacheable(cacheNames = {"guilds"}, key = "#id")
public BatGuild getGuild(@NonNull String id) {
long start = System.currentTimeMillis();
Optional<BatGuild> optionalGuild = guildRepository.findById(id);
@ -54,11 +55,20 @@ public class GuildService extends ListenerAdapter {
*
* @param guild The guild to save
*/
@CachePut(cacheNames = {"guilds"}, key = "#id")
// @CachePut(cacheNames = {"guilds"}, key = "#id")
public void saveGuild(@NonNull BatGuild guild) {
guildRepository.save(guild);
}
/**
* Gets all guilds
*
* @return all guilds
*/
public List<BatGuild> getAllGuilds() {
return guildRepository.findAll();
}
@Override
public final void onGuildJoin(GuildJoinEvent event) {
log.info("Joined guild \"{}\"", event.getGuild().getId());

View File

@ -34,7 +34,7 @@ public class UserService {
* @param id The ID of the user
* @return The user
*/
@Cacheable(cacheNames = {"users"}, key = "#id")
// @Cacheable(cacheNames = {"users"}, key = "#id")
public BatUser getUser(@NonNull String id) {
long start = System.currentTimeMillis();
Optional<BatUser> optionalUser = userRepository.findById(id);
@ -51,7 +51,7 @@ public class UserService {
*
* @param user The user to save
*/
@CachePut(cacheNames = {"users"}, key = "#id")
// @CachePut(cacheNames = {"users"}, key = "#id")
public void saveUser(@NonNull BatUser user) {
userRepository.save(user);
}