Skip to content

Commit eecebc8

Browse files
bdonlanrschmitt
authored andcommitted
Improve Cached annotation documentation
1 parent faafd4f commit eecebc8

File tree

1 file changed

+6
-0
lines changed
  • src/main/java/com/github/rschmitt/dynamicobject

1 file changed

+6
-0
lines changed

src/main/java/com/github/rschmitt/dynamicobject/Cached.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
* Requests that DynamicObject serializers with support for caching or deduplicating repeated values cache the value
1010
* stored under the associated getter or builder. Currently, only the Fressian serializer makes use of this annotation.
1111
* <p/>
12+
* The objects stored under this annotation should implement a sensible equals() and hashCode(); additionally, when
13+
* using @Cached, you should be cognizant that the cache used by the serializer may be quite small - Fressian has only
14+
* 32 entries, for instance, and this is shared with cached map keys as well. Therefore, using @Cached on data that
15+
* cannot be effectively cached can greatly negatively impact the size of the encoded data. In particular, using @Cached
16+
* on data that uses default object identity comparison may be a very bad idea.
17+
* <p/>
1218
* This annotation does not impact binary compatibility of the serialized data.
1319
*
1420
* @since 1.6.0

0 commit comments

Comments
 (0)