Polish contribution

Closes gh-921

Issue: SPR-13690
This commit is contained in:
Stephane Nicoll
2015-12-18 15:46:56 +01:00
parent 13aabeef37
commit 3a238a2b61
6 changed files with 60 additions and 21 deletions

View File

@@ -18,21 +18,21 @@ package org.springframework.cache.caffeine;
import java.util.function.Function;
import com.github.benmanes.caffeine.cache.LoadingCache;
import org.springframework.cache.support.AbstractValueAdaptingCache;
import org.springframework.util.Assert;
import com.github.benmanes.caffeine.cache.LoadingCache;
/**
* Spring {@link org.springframework.cache.Cache} adapter implementation
* on top of a Caffeine {@link com.github.benmanes.caffeine.cache.Cache} instance.
*
* <p>Requires Caffeine 2.0 or higher.
*
* @author Ben Manes
* @author Juergen Hoeller
* @author Stephane Nicoll
* @author Ben Manes
* @since 4.0
* @since 4.3
*/
public class CaffeineCache extends AbstractValueAdaptingCache {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,14 +23,14 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine;
/**
* {@link CacheManager} implementation that lazily builds {@link CaffeineCache}
* instances for each {@link #getCache} request. Also supports a 'static' mode
@@ -43,10 +43,10 @@ import com.github.benmanes.caffeine.cache.Caffeine;
*
* <p>Requires Caffeine 2.0 or higher.
*
* @author Ben Manes
* @author Juergen Hoeller
* @author Stephane Nicoll
* @author Ben Manes
* @since 4.0
* @since 4.3
* @see CaffeineCache
*/
public class CaffeineCacheManager implements CacheManager {
@@ -101,7 +101,7 @@ public class CaffeineCacheManager implements CacheManager {
* Set the Caffeine to use for building each individual
* {@link CaffeineCache} instance.
* @see #createNativeCaffeineCache
* @see com.github.benmanes.caffeine.cache.CacheBuilder#build()
* @see com.github.benmanes.caffeine.cache.Caffeine#build()
*/
public void setCaffeine(Caffeine<Object, Object> cacheBuilder) {
Assert.notNull(cacheBuilder, "Caffeine must not be null");

View File

@@ -16,8 +16,8 @@
package org.springframework.cache.caffeine;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -29,9 +29,9 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
/**
* @author Ben Manes
* @author Juergen Hoeller
* @author Stephane Nicoll
* @author Ben Manes
*/
public class CaffeineCacheManagerTests {
@@ -138,7 +138,7 @@ public class CaffeineCacheManagerTests {
CaffeineCacheManager cm = new CaffeineCacheManager("c1");
Cache cache1 = cm.getCache("c1");
CacheLoader<Object,Object> loader = mockCacheLoader();
CacheLoader<Object, Object> loader = mockCacheLoader();
cm.setCacheLoader(loader);
Cache cache1x = cm.getCache("c1");
assertTrue(cache1x != cache1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,13 @@ import org.springframework.cache.Cache;
import static org.junit.Assert.*;
/**
* @author Stephane Nicoll
* @author Ben Manes
* @author Stephane Nicoll
*/
public class CaffeineCacheTests extends AbstractCacheTests<CaffeineCache> {
private com.github.benmanes.caffeine.cache.Cache<Object, Object> nativeCache;
private CaffeineCache cache;
@Before