File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
src/main/java/org/apache/ibatis/cache Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 18
18
import java .util .concurrent .locks .ReadWriteLock ;
19
19
20
20
/**
21
- * Interface to be implemented by cache providers.
21
+ * SPI for cache providers.
22
22
*
23
23
* One instance of cache will be created for each namespace.
24
24
*
25
25
* The cache implementation must have a constructor that receives the cache id as an String parameter.
26
26
*
27
+ * MyBatis will pass the namespace as id to the constructor.
28
+ *
27
29
* <pre>
28
30
* public MyCache(final String id) {
29
31
* if (id == null) {
@@ -43,13 +45,6 @@ public interface Cache {
43
45
*/
44
46
String getId ();
45
47
46
- /**
47
- * Optional. It is not called by the core.
48
- *
49
- * @return The cache size.
50
- */
51
- int getSize ();
52
-
53
48
/**
54
49
* @param key Can be any object but usually it is a {@link CacheKey}
55
50
* @param value The result of a select.
@@ -75,12 +70,19 @@ public interface Cache {
75
70
*/
76
71
void clear ();
77
72
73
+ /**
74
+ * Optional. This method is not called by the core.
75
+ *
76
+ * @return The number of elements stored in the cache (not its capacity).
77
+ */
78
+ int getSize ();
79
+
78
80
/**
79
- * As of 3.2.6 this method is no longer called by the core.
81
+ * Optional. As of 3.2.6 this method is no longer called by the core.
82
+ *
80
83
* Any locking needed by the cache must be provided internally by the cache provider.
81
84
*
82
85
* @return A ReadWriteLock
83
- * @deprecated
84
86
*/
85
87
ReadWriteLock getReadWriteLock ();
86
88
You can’t perform that action at this time.
0 commit comments