|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmlBlaster.client.SynchronousCache
public final class SynchronousCache
Caches the messages updated from xmlBlaster.
It is used to allow local (client side) cached messages which you can access with the synchronous getCached() method. If XmlBlasterAccess has switched this cache on, a getCached() automatically makes a subscribe() behind the scenes as well and subsequent getCached() are high performing local calls.
XmlBlasterAccess.getCached(GetKey, GetQos)
,
TestSynchronousCache
,
client.cache requirementField Summary | |
---|---|
private Global |
glob
|
private int |
maxQueriesCached
|
private static java.lang.String |
ME
|
private java.util.Hashtable |
query2SubId
key==getQueryString(GetKey getKey), value=subscriptionId |
private java.util.Hashtable |
subscriptions
key==subscriptionId, value=dataHashtable And dataHashtable key=keyOid, value=MsgUnit |
Constructor Summary | |
---|---|
SynchronousCache(Global glob,
int maxQueriesCached)
Create a cache instance. |
Method Summary | |
---|---|
void |
clear()
Destroy all entries in the cash |
MsgUnit[] |
get(GetKey getKey,
GetQos getQos)
Access messages from cache |
int |
getNumQueriesCached()
Return how full is this cache. |
java.lang.String |
getQueryString(GetKey getKey)
Create a unique key for our Hashtable from a GetKey |
private java.lang.String |
getQueryString(java.lang.String subscriptionId)
Access the query key for a given subscriptionId. |
java.util.Hashtable |
getSubscriptions()
Return the registered subscriptions, for internal use only (to check cache). |
boolean |
newEntry(java.lang.String subId,
GetKey getKey,
MsgUnit[] units)
Creates an new entry in the cache |
void |
removeEntry(java.lang.String subId)
Remove a cache entry with the given subscriptionId. |
void |
removeEntryByQueryString(java.lang.String query)
Remove a cache entry with the given query key string. |
void |
removeEntryByQueryString(java.lang.String query,
java.lang.String keyOid)
Remove a MsgUnit from cache with the given query key string and keyOid. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
boolean |
update(java.lang.String subId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
Updated the cache (add a new entry or replaces an existing or removes one). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String ME
private final Global glob
private java.util.Hashtable query2SubId
private java.util.Hashtable subscriptions
private int maxQueriesCached
Constructor Detail |
---|
public SynchronousCache(Global glob, int maxQueriesCached)
Method Detail |
---|
public void removeEntry(java.lang.String subId)
This is usually called by the update() ERASE event
public void removeEntryByQueryString(java.lang.String query, java.lang.String keyOid)
This is usually called by the update() ERASE event for XPATH queries, when the last oid disappears the cache entry is removed
public void removeEntryByQueryString(java.lang.String query)
This is usually called by the update() ERASE event for EXACT queries.
private java.lang.String getQueryString(java.lang.String subscriptionId)
public boolean update(java.lang.String subId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) throws XmlBlasterException
XmlBlasterException
public MsgUnit[] get(GetKey getKey, GetQos getQos) throws XmlBlasterException
XmlBlasterException
public java.lang.String getQueryString(GetKey getKey)
public boolean newEntry(java.lang.String subId, GetKey getKey, MsgUnit[] units) throws XmlBlasterException
XmlBlasterException
public void clear()
public int getNumQueriesCached()
public java.util.Hashtable getSubscriptions()
public final java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags for nice output
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |