This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Method method = PersonController.class.getMethod("show", Long.class); | |
Link link = linkTo(method, 2L).withSelfRel(); | |
assertThat(link.getHref(), is("/people/2"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fm.ask.infrastructure.caching; | |
import org.springframework.cache.CacheManager; | |
public abstract class CacheManagerFactory { | |
protected abstract CacheManager createInstance() ; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fm.ask.infrastructure.caching; | |
import com.google.common.base.Supplier; | |
import com.google.common.base.Ticker; | |
import com.google.common.cache.CacheBuilder; | |
import com.rubylight.conf.IConfListener; | |
import com.rubylight.conf.IConfProperty; | |
import org.springframework.cache.Cache; | |
import org.springframework.cache.CacheManager; | |
import org.springframework.cache.guava.GuavaCacheManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fm.ask.infrastructure.caching; | |
import com.google.common.base.Function; | |
import com.google.common.base.Ticker; | |
import org.springframework.cache.CacheManager; | |
import org.springframework.cache.annotation.EnableCaching; | |
import org.springframework.cache.support.CompositeCacheManager; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DegradesWithDefaultValue | |
@Override | |
public Collection<AnswerNotification> list(AuthorId authorId, Pageable page) { | |
String key = allNotificationsKey(authorId); | |
IRedisCacheDAO dao = shardedNotificationsDAOFactory.getDAOByUserId(authorId.asLong()); | |
Set<Tuple> notifications = dao.zrevrangeWithScoresBinary(key, page.getFrom(), page.getTo() + 1); | |
return transform(notifications, new FromTuple()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Produces("illegal_action") | |
public class MaxNumberOfFolloweesReachedException extends FollowRelationshipAddingException { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository | |
class DefaultDailyQuestionTemplateRepository implements DailyQuestionTemplateRepository { | |
private static final String DAILY_QUESTION_TEMPLATE_CACHE = "dailyQuestionTemplate"; | |
private final DailyQuestionTemplateDAO dailyQuestionTemplateDAO; | |
@Cacheable(DAILY_QUESTION_TEMPLATE_CACHE) | |
@Override | |
public DailyQuestionTemplate get(DailyQuestionTemplateId dailyQuestionTemplateId) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String DAILY_QUESTION_TEMPLATE_CACHE = "dailyQuestionTemplate"; | |
private final DailyQuestionTemplateDAO dailyQuestionTemplateDAO; | |
@Cacheable(DAILY_QUESTION_TEMPLATE_CACHE) | |
@Override | |
public DailyQuestionTemplate get(DailyQuestionTemplateId dailyQuestionTemplateId) { | |
DailyQuestionTemplate dailyQuestionTemplate = dailyQuestionTemplateDAO.getById(dailyQuestionTemplateId); | |
if (dailyQuestionTemplate == null) { | |
throw new EntityDoesNotExistException(dailyQuestionTemplateId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
@ConfigurableMap(value = "map") | |
private IConfProperty<Map<Long, Long>> map | |
@Autowired | |
@ConfigurableProperties(value = "props") | |
private IConfProperty<Properties> props | |
@Autowired | |
@ConfigurableList(value = "list") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
@ConfigurableMap(value = "map", keyType = Long, valueType = Long) | |
private IConfProperty<Map<Long, Long>> map | |
@Autowired | |
@ConfigurableProperties(value = "props") | |
private IConfProperty<Properties> props | |
@Autowired | |
@ConfigurableList(value = "list", itemType = Long) |