File tree 2 files changed +20
-2
lines changed
src/main/java/com/fasterxml/jackson/databind/util
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 15
15
* Since Jackson 2.12, there has been pluggable {@link LookupCache} interface which
16
16
* allows users, frameworks, provide their own cache implementations.
17
17
*<p>
18
- * Snce Jackson 2.14, the implementation
18
+ * Since Jackson 2.14, the implementation
19
19
*<ul>
20
20
*<li>Evicts the least recently used entry when max size is reached
21
21
* </li>
@@ -45,6 +45,12 @@ public LRUMap(int initialEntries, int maxEntries)
45
45
.build ();
46
46
}
47
47
48
+ // @since 2.16
49
+ @ Override
50
+ public LookupCache <K ,V > emptyCopy () {
51
+ return new LRUMap <K ,V >(_initialEntries , _maxEntries );
52
+ }
53
+
48
54
@ Override
49
55
public V put (K key , V value ) {
50
56
return _map .put (key , value );
Original file line number Diff line number Diff line change 9
9
*
10
10
* @since 2.12 (for forwards-compatiblity with 3.0)
11
11
*/
12
- public interface LookupCache <K ,V >
12
+ public interface LookupCache <K ,V >
13
13
{
14
+ /**
15
+ * Method needed for creating clones but without contents.
16
+ *<p>
17
+ * Default implementation th
18
+ *
19
+ * @since 2.16
20
+ */
21
+ default LookupCache <K ,V > emptyCopy () {
22
+ throw new UnsupportedOperationException ("LookupCache implementation "
23
+ +getClass ().getName ()+" does not implement `emptyCopy()`" );
24
+ }
25
+
14
26
/**
15
27
* @return Number of entries currently in cache: may be approximate, only
16
28
* to be used for diagnostics, metrics reporting
You can’t perform that action at this time.
0 commit comments