forked from Sanders/TelegaBot
22 lines
735 B
Java
22 lines
735 B
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 org.springframework.stereotype.Service;
|
|
import ru.cathub.telegabot.model.BookCreationCache;
|
|
|
|
import static ru.cathub.telegabot.utils.Constants.BOOK_CACHE_NAME;
|
|
|
|
|
|
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);
|
|
}
|