public interface DataCache extends TransformerFlags
Allows a Transformer module to retrieve or remove data from the Transformer core's cache.
Modifier and Type | Field and Description |
---|---|
static int |
TIME_UNAVAILABLE
Value returned by
getLastUpdateTime(java.lang.String) if the last update
time for the specified object name was unavailable. |
MAINTAIN_TIMESTAMP, NO_FLAGS, NO_PERSISTENCE, PUBLISH_TO_PEERS, SILENT_SEND, STORE_IN_CACHE
Modifier and Type | Method and Description |
---|---|
void |
deleteType2(String objectName)
Deletes all the type 2 data from the Transformer core for the
specified object name.
|
void |
deleteType2(String objectName,
String type2Index)
Deletes the type 2 entry from the Transformer core for the
specified object name and type 2 index.
|
void |
deleteType2(String objectName,
String type2Index,
int indexFieldNumber)
Deletes the type 2 entry from the Transformer core for the
specified object name, type 2 index and index field number.
|
TransformerData |
get(String objectName)
Gets the data cached within the Transformer core for the
specified object name.
|
String |
getField(String objectName,
int fieldNumber)
Gets the latest value from the Transformer core for the
specified object name and field number.
|
String |
getField(String objectName,
String fieldName)
Gets the latest value from the Transformer core for the
specified object and field names.
|
long |
getLastUpdateTime(String objectName)
Gets the time the last update was received by the Transformer
core for the specified object name.
|
String[] |
getObjectNames(String objectNamePattern)
Gets an array of object names that were found in the
Transformer core cache that match the specified object name
pattern.
|
ObjectType |
getObjectType(String objectName)
Gets the type code for the object with the specified name from the Transformer
core cache.
|
TransformerData |
getPermission(String objectName,
String key)
Gets the permission data cached within the Transformer core for the
specified object name and key.
|
String[] |
getPermissionKeys(String objectName)
Gets a list of permission keys that are available from the
Transformer core cache for the specified object name.
|
ObjectStatus |
getStatus(String objectName)
Gets the current status for the object with the specified name from the
Transformer core cache.
|
TransformerData |
getType2(String objectName,
String type2Index)
Gets the type 2 data cached within the Transformer core for the
specified object name and type 2 index.
|
String[] |
getType2Indices(String objectName)
Gets a list of type 2 indices that are available from the
Transformer core cache for the specified object name.
|
String[] |
getType3Field(String objectName,
int fieldNumber)
Gets an array of values for the specified object name and type
3 field number.
|
void |
put(String objectName)
Sets the flags for the specified object to STORE_IN_CACHE
and PUBLISH_TO_PEERS.
|
void |
put(String objectName,
int flags)
Updates the flags for the specified object.
|
void |
remove(String objectName)
Removes the object with the specified name from the Transformer
core cache.
|
void |
setStatus(String objectName,
ObjectStatus status)
Set the status of an object within the Transformer cache.
|
static final int TIME_UNAVAILABLE
Value returned by getLastUpdateTime(java.lang.String)
if the last update
time for the specified object name was unavailable.
void put(String objectName) throws DataCachePutException
Sets the flags for the specified object to STORE_IN_CACHE and PUBLISH_TO_PEERS. If an object with the specified object name does not exist in the Transformer's cache, then a new object will be created with that name, and with the STORE_IN_CACHE and PUBLISH_TO_PEERS flags set.
Calling this method is equivalent to calling put(objectName, STORE_IN_CACHE|PUBLISH_TO_PEERS).
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.DataCachePutException
- Thrown if the put failed.void put(String objectName, int flags) throws DataCachePutException
Updates the flags for the specified object. If an object with the specified name does not exist in the Transformer's cache, then a new object will be created with that name and the specified flags.
The possible flags are:
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.flags
- The flags the object is going to have set.DataCachePutException
- Thrown if the put failed.NullPointerException
- If the objectName argument is null.TransformerData get(String objectName)
Gets the data cached within the Transformer core for the specified object name.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.NullPointerException
- If the objectName argument is null.long getLastUpdateTime(String objectName)
Gets the time the last update was received by the Transformer core for the specified object name.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.NullPointerException
- If the objectName argument is null.TransformerData getType2(String objectName, String type2Index)
Gets the type 2 data cached within the Transformer core for the specified object name and type 2 index.
The table below shows some sample type 2 data that may be cached for the object /LO/CAPLIN. In this case, the MarketMakerId field contains the type 2 indices. To get the data for the MarketMaker GBN, the Transformer module should call getType2("/LO/CAPLIN", "GBN").
MarketMakerId | BidSize | Bid | Ask | AskSize |
---|---|---|---|---|
BRC | 1000 | 52 1/2 | 54 | 750 |
GBN | 500 | 53 | 54 | 1000 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.type2Index
- The index for the type 2 data that is required.NullPointerException
- If either the objectName or
type2Index arguments are null.String[] getType2Indices(String objectName)
Gets a list of type 2 indices that are available from the Transformer core cache for the specified object name.
The table below shows some sample type 2 data that may be cached for the object /LO/CAPLIN. In this case, the MarketMakerId field contains the type 2 indices. If the Transformer module calls getType2Indices("/LO/CAPLIN"), an array containing "BRC", "GBN" and "TLT" will be returned.
MarketMakerId | BidSize | Bid | Ask | AskSize |
---|---|---|---|---|
BRC | 1000 | 52 1/2 | 54 | 750 |
GBN | 500 | 53 | 54 | 1000 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.NullPointerException
- If the objectName argument is null.TransformerData getPermission(String objectName, String key)
Gets the permission data cached within the Transformer core for the specified object name and key.
See getType2 for structure information. Permission objects have the same structure as type 2 records.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.key
- The key for the permission data that is required.NullPointerException
- If either the objectName or
key arguments are null.String[] getPermissionKeys(String objectName)
Gets a list of permission keys that are available from the Transformer core cache for the specified object name.
See getType2Indices for structure information. Permission objects have the same structure as type 2 records.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.NullPointerException
- If the objectName argument is null.String getField(String objectName, String fieldName)
Gets the latest value from the Transformer core for the specified object and field names.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.fieldName
- The name of the field.NullPointerException
- If either the objectName of
fieldName arguments are null.String getField(String objectName, int fieldNumber)
Gets the latest value from the Transformer core for the specified object name and field number.
objectName
- The name of the object. This must be an exact
object name - it cannot be
object name pattern.fieldNumber
- The field number.NullPointerException
- If the objectName argument is null.String[] getType3Field(String objectName, int fieldNumber)
Gets an array of values for the specified object name and type 3 field number. The array is in chronological order, with the most recent value at the start, and the oldest value at the end.
The table below shows some sample type 3 data that may be cached for the object /LO/CAPLIN. In this case, the TradePrice, TradeTime and TradeVolume fields are all type 3 fields. If the TradePrice field number is 18, then if the Transformer module calls getType3Field("/LO/CAPLIN", 18), an array containing "53 3/4", "54 1/2", "54 1/4". "54" and "53 1/2" will be returned.
TradePrice | TradeTime | TradeVolume |
---|---|---|
53 3/4 | 10:19 | 10000 |
54 1/2 | 10:19 | 600 |
54 1/4 | 10:18 | 1000 |
54 | 10:17 | 1233 |
53 1/2 | 10:17 | 67 |
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.fieldNumber
- The type 3 field number.NullPointerException
- If the objectName argument is null.String[] getObjectNames(String objectNamePattern)
Gets an array of object names that were found in the Transformer core cache that match the specified object name pattern.
objectNamePattern
- The object name pattern
that will be matched against the objects
within the Transformer core cache.NullPointerException
- If the objectNamePattern argument is
null.void deleteType2(String objectName)
Deletes all the type 2 data from the Transformer core for the specified object name.
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.NullPointerException
- If the objectName argument is null.void deleteType2(String objectName, String type2Index)
Deletes the type 2 entry from the Transformer core for the
specified object name and type 2 index. This method assumes that
the type 2 entries are indices under the field MktMkrId.
If the type 2 entries are indexed by a different field, the
deleteType2(String, String, int)
method should be used
instead.
The tables below show some sample type 2 data that may be cached for the object /LO/CAPLIN. In this case, the MktMkrId field contains the type 2 indices. The first table shows the type 2 data that is available before the call deleteType2("/LO/CAPLIN", "GBN") is made. The second table shows the data that is available afterwards.
Before deleteType2("/LO/CAPLIN", "GBN") is called:
MktMkrId | BidSize | Bid | Ask | AskSize |
---|---|---|---|---|
BRC | 1000 | 52 1/2 | 54 | 750 |
GBN | 500 | 53 | 54 | 1000 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
After deleteType2("/LO/CAPLIN", "GBN") is called:
MktMkrId | BidSize | Bid | Ask | AskSize |
---|---|---|---|---|
BRC | 1000 | 52 1/2 | 54 | 750 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
objectName
- The name of the object. This must be an exact
object name - it cannot be an
object name pattern.type2Index
- The index for the type 2 entry that should be
deleted.NullPointerException
- If either the objectName or
type2Index arguments are null.void deleteType2(String objectName, String type2Index, int indexFieldNumber)
Deletes the type 2 entry from the Transformer core for the specified object name, type 2 index and index field number.
The tables below show some sample type 2 data that may be cached for the object /LO/CAPLIN, with the type 2 indices stored under the field MARKET_MAKER_ID (field number 212). The first table shows the type 2 data that is available before the call deleteType2("/LO/CAPLIN", "BRC", 212) is made. The second table shows the data that is available afterwards.
Before deleteType2("/LO/CAPLIN", "BRC", 212) is called:
MARKET_MAKER_ID | BIDSIZE | BID | ASK | ASKSIZE |
---|---|---|---|---|
BRC | 1000 | 52 1/2 | 54 | 750 |
GBN | 500 | 53 | 54 | 1000 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
After deleteType2("/LO/CAPLIN", "BRC", 212) is called:
MARKET_MAKER_ID | BidSize | Bid | Ask | AskSize |
---|---|---|---|---|
GBN | 500 | 53 | 54 | 1000 |
TLT | 1000 | 53 | 53 3/4 | 1000 |
objectName
- The name of the object. This must be an
exact object name - it cannot be an
object name pattern.type2Index
- The index for the type 2 entry that should
be deleted.indexFieldNumber
- The field number under which the type 2
entries are indexed.NullPointerException
- If either the objectName or
type2Index arguments are null.void remove(String objectName)
Removes the object with the specified name from the Transformer core cache.
objectName
- The name of the object. This must be an exact
object name - it cannot be an object name
pattern.NullPointerException
- If the objectName argument is null.ObjectStatus getStatus(String objectName)
Gets the current status for the object with the specified name from the Transformer core cache.
objectName
- The name of the object the status is required for. This
must be an exact object name - it cannot be an object
name pattern.ServiceStatus.STALE
.NullPointerException
- If the objectName argument is null.void setStatus(String objectName, ObjectStatus status)
Set the status of an object within the Transformer cache. This status will be propagated to any interested peers or modules.
objectName
- The name of the object the status is being changed on.status
- The new status for the object.NullPointerException
- If the objectName or status arguments are null.ObjectType getObjectType(String objectName)
Gets the type code for the object with the specified name from the Transformer core cache.
objectName
- The name of the object the status is required for. This
must be an exact object name - it cannot be an object
name pattern.ObjectType
of the specified object. If the object
is not currently in the cache, this method will return
ObjectType.UNDEFINED
.NullPointerException
- If the objectName argument is null.Please send bug reports and comments to Caplin support