Skip to content

Commit ac29e9d

Browse files
committed
Document that CacheManager.getCache() may create a new Cache
Prior to this commit, it was unclear that an invocation of getCache() might potentially create a new Cache. This commit updates the Javadoc to point out that concrete CacheManager implementations may choose to create a new Cache at runtime if the Cache does not already exist. Closes gh-23193
1 parent dda4dfb commit ac29e9d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

spring-context/src/main/java/org/springframework/cache/CacheManager.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,23 +22,28 @@
2222

2323
/**
2424
* Spring's central cache manager SPI.
25-
* Allows for retrieving named {@link Cache} regions.
25+
*
26+
* <p>Allows for retrieving named {@link Cache} regions.
2627
*
2728
* @author Costin Leau
29+
* @author Sam Brannen
2830
* @since 3.1
2931
*/
3032
public interface CacheManager {
3133

3234
/**
33-
* Return the cache associated with the given name.
35+
* Get the cache associated with the given name.
36+
* <p>Note that the cache may be created at runtime if the native provider
37+
* supports it.
3438
* @param name the cache identifier (must not be {@code null})
35-
* @return the associated cache, or {@code null} if none found
39+
* @return the associated cache, or {@code null} if such a cache does not
40+
* exist or could be not created
3641
*/
3742
@Nullable
3843
Cache getCache(String name);
3944

4045
/**
41-
* Return a collection of the cache names known by this manager.
46+
* Get a collection of the cache names known by this manager.
4247
* @return the names of all caches known by the cache manager
4348
*/
4449
Collection<String> getCacheNames();

0 commit comments

Comments
 (0)