public interface BeaconCache
| Modifier and Type | Method and Description |
|---|---|
void |
addActionData(BeaconKey key,
long timestamp,
java.lang.String data)
Add action data for a given
beaconID to this cache. |
void |
addEventData(BeaconKey key,
long timestamp,
java.lang.String data)
Add event data for a given
key to this cache. |
void |
addObserver(java.util.Observer o)
Add an
Observer which gets notified after a new event data or action data got inserted. |
void |
deleteCacheEntry(BeaconKey key)
Delete a cache entry for a given
key. |
int |
evictRecordsByAge(BeaconKey key,
long minTimestamp)
Evict
beacon cache records by age for a given beacon. |
int |
evictRecordsByNumber(BeaconKey key,
int numRecords)
Evict
beacon cache records by number for given beacon. |
java.util.Set<BeaconKey> |
getBeaconKeys()
Get a Set of currently inserted
BeaconKeys. |
java.lang.String |
getNextBeaconChunk(BeaconKey key,
java.lang.String chunkPrefix,
int maxSize,
char delimiter)
Get the next chunk for sending to the backend.
|
long |
getNumBytesInCache()
Get number of bytes currently stored in cache.
|
boolean |
isEmpty(BeaconKey key)
Tests if an cached entry for
key is empty. |
void |
removeChunkedData(BeaconKey key)
Remove all data that was previously included in chunks.
|
void |
resetChunkedData(BeaconKey key)
Reset all data that was previously included in chunks.
|
void addObserver(java.util.Observer o)
Observer which gets notified after a new event data or action data got inserted.o - Observer to add.void addEventData(BeaconKey key, long timestamp, java.lang.String data)
key to this cache.
All registered observers are notified, after the event data has been added.
key - The key of the beacon (aka Session ID and Session seq. no.) for which to add event data.timestamp - The data's timestamp.data - serialized event data to add.void addActionData(BeaconKey key, long timestamp, java.lang.String data)
beaconID to this cache.key - The key of the beacon (aka Session ID and Session seq. no.) for which to add action data.timestamp - The data's timestamp.data - serialized action data to add.void deleteCacheEntry(BeaconKey key)
key.key - The beacon's ID (aka Session ID and Session seq. no.) which to delete.java.lang.String getNextBeaconChunk(BeaconKey key, java.lang.String chunkPrefix, int maxSize, char delimiter)
Note: This method must only be invoked from the beacon sending thread.
key - The key of the beacon for which to get the next chunk.chunkPrefix - Prefix to append to the beginning of the chunk.maxSize - Maximum chunk size. As soon as chunk's size is greater than or equal to maxSize result is returned.delimiter - Delimiter between consecutive chunks.null if given key does not exist, an empty string, if there is no more data to send
or the next chunk to send.void removeChunkedData(BeaconKey key)
This method must be called, when data retrieved via getNextBeaconChunk(BeaconKey, String, int, char)
was successfully sent to the backend, otherwise subsequent calls to getNextBeaconChunk(BeaconKey, String, int, char)
will retrieve the same data again and again.
Note: This method must only be invoked from the beacon sending thread.
key - The key of the beacon for which to remove already chunked data.void resetChunkedData(BeaconKey key)
Note: This method must only be invoked from the beacon sending thread.
key - The key of the beacon for which to remove already chunked data.java.util.Set<BeaconKey> getBeaconKeys()
BeaconKeys.
The return value is a snapshot of currently inserted beacon keys. All changes made after this call are not reflected in the returned Set.
int evictRecordsByAge(BeaconKey key, long minTimestamp)
beacon cache records by age for a given beacon.key - The key identifying a beacon.minTimestamp - The minimum timestamp allowed.int evictRecordsByNumber(BeaconKey key, int numRecords)
beacon cache records by number for given beacon.key - The key identifying a beacon beacon.numRecords - The maximum number of records to evict.long getNumBytesInCache()
boolean isEmpty(BeaconKey key)
key is empty.key - The key identifying a beacon.true if the cached entry is empty, false otherwise.