forked from Sanders/TelegaBot
41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package ru.cathub.telegabot.service;
|
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
import org.springframework.cache.annotation.CachePut;
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
import ru.cathub.telegabot.model.BookCreationCache;
|
|
import ru.cathub.telegabot.model.BookEditStateCache;
|
|
import ru.cathub.telegabot.model.BookListCache;
|
|
|
|
import static ru.cathub.telegabot.utils.Constants.*;
|
|
|
|
|
|
public interface BookCacheService {
|
|
@Cacheable(value = BOOK_CACHE_NAME, key = "#userId")
|
|
BookCreationCache getCache(Long userId);
|
|
|
|
@CachePut(value = BOOK_CACHE_NAME, key = "#userId")
|
|
BookCreationCache updateCache(Long userId, BookCreationCache cache);
|
|
|
|
@CacheEvict(value = BOOK_CACHE_NAME, key = "#userId")
|
|
void clearCache(Long userId);
|
|
|
|
@Cacheable(value = BOOK_CACHE_LIST, key = "#userId")
|
|
BookListCache getBookListState(Long userId);
|
|
|
|
@CachePut(value = BOOK_CACHE_LIST, key = "#userId")
|
|
BookListCache updateBookListState(Long userId, BookListCache state);
|
|
|
|
@Cacheable(value = BOOK_CACHE_EDIT, key = "#userId")
|
|
BookEditStateCache getBookEditCache(Long userId);
|
|
|
|
@CachePut(value = BOOK_CACHE_EDIT, key = "#userId")
|
|
BookEditStateCache updateBookEditCache(Long userId, BookEditStateCache cache);
|
|
|
|
@CacheEvict(value = BOOK_CACHE_EDIT, key = "#userId")
|
|
void clearBookEditCache(Long userId);
|
|
|
|
@CacheEvict(value = BOOK_CACHE_LIST, key = "#userId")
|
|
void clearBookListCache(Long userId);
|
|
}
|