public interface BeaconCache
| Modifier and Type | Method and Description |
|---|---|
void |
addActionData(java.lang.Integer beaconID,
long timestamp,
java.lang.String data)
Add action data for a given
beaconID to this cache. |
void |
addEventData(java.lang.Integer beaconID,
long timestamp,
java.lang.String data)
Add event data for a given
beaconID 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(java.lang.Integer beaconID)
Delete a cache entry for a given
beaconID. |
int |
evictRecordsByAge(java.lang.Integer beaconID,
long minTimestamp)
Evict
beacon cache records by age for a given beacon. |
int |
evictRecordsByNumber(java.lang.Integer beaconID,
int numRecords)
Evict
beacon cache records by number for given beacon. |
java.util.Set<java.lang.Integer> |
getBeaconIDs()
Get a Set of currently inserted Beacon ids.
|
java.lang.String |
getNextBeaconChunk(java.lang.Integer beaconID,
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(java.lang.Integer beaconID)
Tests if an cached entry for
beaconID is empty. |
void |
removeChunkedData(java.lang.Integer beaconID)
Remove all data that was previously included in chunks.
|
void |
resetChunkedData(java.lang.Integer beaconID)
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(java.lang.Integer beaconID,
long timestamp,
java.lang.String data)
beaconID to this cache.
All registered observers are notified, after the event data has been added.
beaconID - The beacon's ID (aka Session ID) for which to add event data.timestamp - The data's timestamp.data - serialized event data to add.void addActionData(java.lang.Integer beaconID,
long timestamp,
java.lang.String data)
beaconID to this cache.beaconID - The beacon's ID (aka Session ID) for which to add action data.timestamp - The data's timestamp.data - serialized action data to add.void deleteCacheEntry(java.lang.Integer beaconID)
beaconID.beaconID - The beacon's ID (aka Session ID) which to delete.java.lang.String getNextBeaconChunk(java.lang.Integer beaconID,
java.lang.String chunkPrefix,
int maxSize,
char delimiter)
Note: This method must only be invoked from the beacon sending thread.
beaconID - The beacon id 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 beaconID does not exist, an empty string, if there is no more data to send
or the next chunk to send.void removeChunkedData(java.lang.Integer beaconID)
This method must be called, when data retrieved via getNextBeaconChunk(Integer, String, int, char)
was successfully sent to the backend, otherwise subsequent calls to getNextBeaconChunk(Integer, String, int, char)
will retrieve the same data again and again.
Note: This method must only be invoked from the beacon sending thread.
beaconID - The beacon id for which to remove already chunked data.void resetChunkedData(java.lang.Integer beaconID)
Note: This method must only be invoked from the beacon sending thread.
beaconID - The beacon id for which to remove already chunked data.java.util.Set<java.lang.Integer> getBeaconIDs()
The return value is a snapshot of currently inserted beacon ids. All changes made after this call are not reflected in the returned Set.
int evictRecordsByAge(java.lang.Integer beaconID,
long minTimestamp)
beacon cache records by age for a given beacon.beaconID - The beacon's identifier.minTimestamp - The minimum timestamp allowed.int evictRecordsByNumber(java.lang.Integer beaconID,
int numRecords)
beacon cache records by number for given beacon.beaconID - The beacon's identifier.numRecords - The maximum number of records to evict.long getNumBytesInCache()
boolean isEmpty(java.lang.Integer beaconID)
beaconID is empty.beaconID - beaconID The beacon's identifier.true if the cached entry is empty, false otherwise.