MCPcopy Index your code
hub / github.com/ccxt/ccxt / append

Method append

java/lib/src/main/java/io/github/ccxt/ws/ArrayCache.java:56–71  ·  view source on GitHub ↗

Append an item to the cache. Evicts oldest if full. Tracks new updates per symbol for the newUpdates mechanism.

(Object item)

Source from the content-addressed store, hash-verified

54 * Tracks new updates per symbol for the newUpdates mechanism.
55 */
56 @SuppressWarnings("unchecked")
57 public synchronized void append(Object item) {
58 if (this.size() >= this.maxSize) {
59 this.remove(0);
60 }
61 this.add(item);
62 this.newUpdates.incrementAndGet();
63
64 // Track per-symbol if item has a symbol field
65 if (item instanceof Map) {
66 Object symbol = ((Map<String, Object>) item).get("symbol");
67 if (symbol instanceof String s) {
68 this.newUpdatesBySymbol.merge(s, 1, Integer::sum);
69 }
70 }
71 }
72
73 /**
74 * Get the number of new updates (since last call) for a symbol.

Callers 15

testAppendAndSizeMethod · 0.95
testMaxSizeEvictionMethod · 0.95
argsStrMethod · 0.45
argsToStringMethod · 0.45
transformApiNewMethod · 0.45
exceptionMessageMethod · 0.45
escapeIllegalUriCharsMethod · 0.45
bytesToHexMethod · 0.45
encodeTypeMethod · 0.45
randNumberMethod · 0.45
binaryToHexMethod · 0.45

Calls 3

removeMethod · 0.45
addMethod · 0.45
getMethod · 0.45

Tested by 7

testAppendAndSizeMethod · 0.76
testMaxSizeEvictionMethod · 0.76
argsStrMethod · 0.36
argsToStringMethod · 0.36
dumpMethod · 0.36
exceptionMessageMethod · 0.36